home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / u_man / cat1 / perlguts.Z / perlguts
Encoding:
Text File  |  1998-10-28  |  145.1 KB  |  4,753 lines

  1.  
  2.  
  3.  
  4.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       perlguts - Perl's Internal Functions
  10.  
  11.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.       This document    attempts to describe some of the internal
  13.       functions of the Perl    executable.  It    is far from complete
  14.       and probably contains    many errors.  Please refer any
  15.       questions or comments    to the author below.
  16.  
  17.      VVVVaaaarrrriiiiaaaabbbblllleeeessss
  18.       DDDDaaaattttaaaattttyyyyppppeeeessss
  19.  
  20.       Perl has three typedefs that handle Perl's three main    data
  21.       types:
  22.  
  23.           SV  Scalar Value
  24.           AV  Array    Value
  25.           HV  Hash Value
  26.  
  27.       Each typedef has specific routines that manipulate the
  28.       various data types.
  29.  
  30.       WWWWhhhhaaaatttt iiiissss aaaannnn """"IIIIVVVV""""????
  31.  
  32.       Perl uses a special typedef IV which is a simple integer
  33.       type that is guaranteed to be    large enough to    hold a pointer
  34.       (as well as an integer).
  35.  
  36.       Perl also uses two special typedefs, I32 and I16, which will
  37.       always be at least 32-bits and 16-bits long, respectively.
  38.  
  39.       WWWWoooorrrrkkkkiiiinnnngggg wwwwiiiitttthhhh SSSSVVVVssss
  40.  
  41.       An SV    can be created and loaded with one command.  There are
  42.       four types of    values that can    be loaded: an integer value
  43.       (IV),    a double (NV), a string, (PV), and another scalar
  44.       (SV).
  45.  
  46.       The six routines are:
  47.  
  48.           SV*  newSViv(IV);
  49.           SV*  newSVnv(double);
  50.           SV*  newSVpv(char*, int);
  51.           SV*  newSVpvn(char*, int);
  52.           SV*  newSVpvf(const char*, ...);
  53.           SV*  newSVsv(SV*);
  54.  
  55.       To change the    value of an *already-existing* SV, there are
  56.       seven    routines:
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  71.  
  72.  
  73.  
  74.           void  sv_setiv(SV*, IV);
  75.           void  sv_setuv(SV*, UV);
  76.           void  sv_setnv(SV*, double);
  77.           void  sv_setpv(SV*, char*);
  78.           void  sv_setpvn(SV*, char*, int)
  79.           void  sv_setpvf(SV*, const char*,    ...);
  80.           void  sv_setpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32,    bool);
  81.           void  sv_setsv(SV*, SV*);
  82.  
  83.       Notice that you can choose to    specify    the length of the
  84.       string to be assigned    by using sv_setpvn, newSVpvn, or
  85.       newSVpv, or you may allow Perl to calculate the length by
  86.       using    sv_setpv or by specifying 0 as the second argument to
  87.       newSVpv.  Be warned, though, that Perl will determine    the
  88.       string's length by using strlen, which depends on the    string
  89.       terminating with a NUL character.
  90.  
  91.       The arguments    of sv_setpvf are processed like    sprintf, and
  92.       the formatted    output becomes the value.
  93.  
  94.       sv_setpvfn is    an analogue of vsprintf, but it    allows you to
  95.       specify either a pointer to a    variable argument list or the
  96.       address and length of    an array of SVs.  The last argument
  97.       points to a boolean; on return, if that boolean is true,
  98.       then locale-specific information has been used to format the
  99.       string, and the string's contents are    therefore untrustworty
  100.       (see the _p_e_r_l_s_e_c manpage).  This pointer may be NULL if that
  101.       information is not important.     Note that this    function
  102.       requires you to specify the length of    the format.
  103.  
  104.       The sv_set*()    functions are not generic enough to operate on
  105.       values that have "magic".  See the section on    _M_a_g_i_c _V_i_r_t_u_a_l
  106.       _T_a_b_l_e_s later in this document.
  107.  
  108.       All SVs that contain strings should be terminated with a NUL
  109.       character.  If it is not NUL-terminated there    is a risk of
  110.       core dumps and corruptions from code which passes the    string
  111.       to C functions or system calls which expect a    NUL-terminated
  112.       string.  Perl's own functions    typically add a    trailing NUL
  113.       for this reason.  Nevertheless, you should be    very careful
  114.       when you pass    a string stored    in an SV to a C    function or
  115.       system call.
  116.  
  117.       To access the    actual value that an SV    points to, you can use
  118.       the macros:
  119.  
  120.           SvIV(SV*)
  121.           SvNV(SV*)
  122.           SvPV(SV*,    STRLEN len)
  123.  
  124.       which    will automatically coerce the actual scalar type into
  125.       an IV, double, or string.
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  137.  
  138.  
  139.  
  140.       In the SvPV macro, the length    of the string returned is
  141.       placed into the variable len (this is    a macro, so you    do _n_o_t
  142.       use &len).  If you do    not care what the length of the    data
  143.       is, use the global variable PL_na.  Remember,    however, that
  144.       Perl allows arbitrary    strings    of data    that may both contain
  145.       NULs and might not be    terminated by a    NUL.
  146.  
  147.       If you want to know if the scalar value is TRUE, you can
  148.       use:
  149.  
  150.           SvTRUE(SV*)
  151.  
  152.       Although Perl    will automatically grow    strings    for you, if
  153.       you need to force Perl to allocate more memory for your SV,
  154.       you can use the macro
  155.  
  156.           SvGROW(SV*, STRLEN newlen)
  157.  
  158.       which    will determine if more memory needs to be allocated.
  159.       If so, it will call the function sv_grow.  Note that SvGROW
  160.       can only increase, not decrease, the allocated memory    of an
  161.       SV and that it does not automatically    add a byte for the a
  162.       trailing NUL (perl's own string functions typically do
  163.       SvGROW(sv, len + 1)).
  164.  
  165.       If you have an SV and    want to    know what kind of data Perl
  166.       thinks is stored in it, you can use the following macros to
  167.       check    the type of SV you have.
  168.  
  169.           SvIOK(SV*)
  170.           SvNOK(SV*)
  171.           SvPOK(SV*)
  172.  
  173.       You can get and set the current length of the    string stored
  174.       in an    SV with    the following macros:
  175.  
  176.           SvCUR(SV*)
  177.           SvCUR_set(SV*, I32 val)
  178.  
  179.       You can also get a pointer to    the end    of the string stored
  180.       in the SV with the macro:
  181.  
  182.           SvEND(SV*)
  183.  
  184.       But note that    these last three macros    are valid only if
  185.       SvPOK() is true.
  186.  
  187.       If you want to append    something to the end of    string stored
  188.       in an    SV*, you can use the following functions:
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  203.  
  204.  
  205.  
  206.           void  sv_catpv(SV*, char*);
  207.           void  sv_catpvn(SV*, char*, int);
  208.           void  sv_catpvf(SV*, const char*,    ...);
  209.           void  sv_catpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32,    bool);
  210.           void  sv_catsv(SV*, SV*);
  211.  
  212.       The first function calculates    the length of the string to be
  213.       appended by using strlen.  In    the second, you    specify    the
  214.       length of the    string yourself.  The third function processes
  215.       its arguments    like sprintf and appends the formatted output.
  216.       The fourth function works like vsprintf.  You    can specify
  217.       the address and length of an array of    SVs instead of the
  218.       va_list argument. The    fifth function extends the string
  219.       stored in the    first SV with the string stored    in the second
  220.       SV.  It also forces the second SV to be interpreted as a
  221.       string.
  222.  
  223.       The sv_cat*()    functions are not generic enough to operate on
  224.       values that have "magic".  See the section on    _M_a_g_i_c _V_i_r_t_u_a_l
  225.       _T_a_b_l_e_s later in this document.
  226.  
  227.       If you know the name of a scalar variable, you can get a
  228.       pointer to its SV by using the following:
  229.  
  230.           SV*  perl_get_sv("package::varname", FALSE);
  231.  
  232.       This returns NULL if the variable does not exist.
  233.  
  234.       If you want to know if this variable (or any other SV) is
  235.       actually defined, you    can call:
  236.  
  237.           SvOK(SV*)
  238.  
  239.       The scalar undef value is stored in an SV instance called
  240.       PL_sv_undef.    Its address can    be used    whenever an SV*    is
  241.       needed.
  242.  
  243.       There    are also the two values    PL_sv_yes and PL_sv_no,    which
  244.       contain Boolean TRUE and FALSE values, respectively.    Like
  245.       PL_sv_undef, their addresses can be used whenever an SV* is
  246.       needed.
  247.  
  248.       Do not be fooled into    thinking that (SV *) 0 is the same as
  249.       &PL_sv_undef.     Take this code:
  250.  
  251.           SV* sv = (SV*) 0;
  252.           if (I-am-to-return-a-real-value) {
  253.               sv = sv_2mortal(newSViv(42));
  254.           }
  255.           sv_setsv(ST(0), sv);
  256.  
  257.       This code tries to return a new SV (which contains the value
  258.  
  259.  
  260.  
  261.      Page 4                        (printed 10/23/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  269.  
  270.  
  271.  
  272.       42) if it should return a real value,    or undef otherwise.
  273.       Instead it has returned a NULL pointer which,    somewhere down
  274.       the line, will cause a segmentation violation, bus error, or
  275.       just weird results.  Change the zero to &PL_sv_undef in the
  276.       first    line and all will be well.
  277.  
  278.       To free an SV    that you've created, call SvREFCNT_dec(SV*).
  279.       Normally this    call is    not necessary (see the section on
  280.       _R_e_f_e_r_e_n_c_e _C_o_u_n_t_s _a_n_d _M_o_r_t_a_l_i_t_y).
  281.  
  282.       WWWWhhhhaaaatttt''''ssss RRRReeeeaaaallllllllyyyy    SSSSttttoooorrrreeeedddd iiiinnnn aaaannnn SSSSVVVV????
  283.  
  284.       Recall that the usual    method of determining the type of
  285.       scalar you have is to    use Sv*OK macros.  Because a scalar
  286.       can be both a    number and a string, usually these macros will
  287.       always return    TRUE and calling the Sv*V macros will do the
  288.       appropriate conversion of string to integer/double or
  289.       integer/double to string.
  290.  
  291.       If you _r_e_a_l_l_y    need to    know if    you have an integer, double,
  292.       or string pointer in an SV, you can use the following    three
  293.       macros instead:
  294.  
  295.           SvIOKp(SV*)
  296.           SvNOKp(SV*)
  297.           SvPOKp(SV*)
  298.  
  299.       These    will tell you if you truly have    an integer, double, or
  300.       string pointer stored    in your    SV.  The "p" stands for
  301.       private.
  302.  
  303.       In general, though, it's best    to use the Sv*V    macros.
  304.  
  305.       WWWWoooorrrrkkkkiiiinnnngggg wwwwiiiitttthhhh AAAAVVVVssss
  306.  
  307.       There    are two    ways to    create and load    an AV.    The first
  308.       method creates an empty AV:
  309.  
  310.           AV*  newAV();
  311.  
  312.       The second method both creates the AV    and initially
  313.       populates it with SVs:
  314.  
  315.           AV*  av_make(I32 num, SV **ptr);
  316.  
  317.       The second argument points to    an array containing num    SV*'s.
  318.       Once the AV has been created,    the SVs    can be destroyed, if
  319.       so desired.
  320.  
  321.       Once the AV has been created,    the following operations are
  322.       possible on AVs:
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                        (printed 10/23/98)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  335.  
  336.  
  337.  
  338.           void  av_push(AV*, SV*);
  339.           SV*   av_pop(AV*);
  340.           SV*   av_shift(AV*);
  341.           void  av_unshift(AV*, I32    num);
  342.  
  343.       These    should be familiar operations, with the    exception of
  344.       av_unshift.  This routine adds num elements at the front of
  345.       the array with the undef value.  You must then use av_store
  346.       (described below) to assign values to    these new elements.
  347.  
  348.       Here are some    other functions:
  349.  
  350.           I32   av_len(AV*);
  351.           SV**  av_fetch(AV*, I32 key, I32 lval);
  352.           SV**  av_store(AV*, I32 key, SV* val);
  353.  
  354.       The av_len function returns the highest index    value in array
  355.       (just    like $#array in    Perl).    If the array is    empty, -1 is
  356.       returned.  The av_fetch function returns the value at    index
  357.       key, but if lval is non-zero,    then av_fetch will store an
  358.       undef    value at that index.  The av_store function stores the
  359.       value    val at index key, and does not increment the reference
  360.       count    of val.     Thus the caller is responsible    for taking
  361.       care of that,    and if av_store    returns    NULL, the caller will
  362.       have to decrement the    reference count    to avoid a memory
  363.       leak.     Note that av_fetch and    av_store both return SV**'s,
  364.       not SV*'s as their return value.
  365.  
  366.           void  av_clear(AV*);
  367.           void  av_undef(AV*);
  368.           void  av_extend(AV*, I32 key);
  369.  
  370.       The av_clear function    deletes    all the    elements in the    AV*
  371.       array, but does not actually delete the array    itself.     The
  372.       av_undef function will delete    all the    elements in the    array
  373.       plus the array itself.  The av_extend    function extends the
  374.       array    so that    it contains key    elements.  If key is less than
  375.       the current length of    the array, then    nothing    is done.
  376.  
  377.       If you know the name of an array variable, you can get a
  378.       pointer to its AV by using the following:
  379.  
  380.           AV*  perl_get_av("package::varname", FALSE);
  381.  
  382.       This returns NULL if the variable does not exist.
  383.  
  384.       See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d _H_a_s_h_e_s
  385.       _a_n_d _A_r_r_a_y_s for more information on how to use    the array
  386.       access functions on tied arrays.
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.      Page 6                        (printed 10/23/98)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  401.  
  402.  
  403.  
  404.       WWWWoooorrrrkkkkiiiinnnngggg wwwwiiiitttthhhh HHHHVVVVssss
  405.  
  406.       To create an HV, you use the following routine:
  407.  
  408.           HV*  newHV();
  409.  
  410.       Once the HV has been created,    the following operations are
  411.       possible on HVs:
  412.  
  413.           SV**  hv_store(HV*, char*    key, U32 klen, SV* val,    U32 hash);
  414.           SV**  hv_fetch(HV*, char*    key, U32 klen, I32 lval);
  415.  
  416.       The klen parameter is    the length of the key being passed in
  417.       (Note    that you cannot    pass 0 in as a value of    klen to    tell
  418.       Perl to measure the length of    the key).  The val argument
  419.       contains the SV pointer to the scalar    being stored, and hash
  420.       is the precomputed hash value    (zero if you want hv_store to
  421.       calculate it for you).  The lval parameter indicates whether
  422.       this fetch is    actually a part    of a store operation, in which
  423.       case a new undefined value will be added to the HV with the
  424.       supplied key and hv_fetch will return    as if the value    had
  425.       already existed.
  426.  
  427.       Remember that    hv_store and hv_fetch return SV**'s and    not
  428.       just SV*.  To    access the scalar value, you must first
  429.       dereference the return value.     However, you should check to
  430.       make sure that the return value is not NULL before
  431.       dereferencing    it.
  432.  
  433.       These    two functions check if a hash table entry exists, and
  434.       deletes it.
  435.  
  436.           bool  hv_exists(HV*, char* key, U32 klen);
  437.           SV*   hv_delete(HV*, char* key, U32 klen,    I32 flags);
  438.  
  439.       If flags does    not include the    G_DISCARD flag then hv_delete
  440.       will create and return a mortal copy of the deleted value.
  441.  
  442.       And more miscellaneous functions:
  443.  
  444.           void   hv_clear(HV*);
  445.           void   hv_undef(HV*);
  446.  
  447.       Like their AV    counterparts, hv_clear deletes all the entries
  448.       in the hash table but    does not actually delete the hash
  449.       table.  The hv_undef deletes both the    entries    and the    hash
  450.       table    itself.
  451.  
  452.       Perl keeps the actual    data in    linked list of structures with
  453.       a typedef of HE.  These contain the actual key and value
  454.       pointers (plus extra administrative overhead).  The key is a
  455.       string pointer; the value is an SV*.    However, once you have
  456.  
  457.  
  458.  
  459.      Page 7                        (printed 10/23/98)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  467.  
  468.  
  469.  
  470.       an HE*, to get the actual key    and value, use the routines
  471.       specified below.
  472.  
  473.           I32    hv_iterinit(HV*);
  474.               /* Prepares starting point to traverse hash table    */
  475.           HE*    hv_iternext(HV*);
  476.               /* Get the next entry, and return    a pointer to a
  477.              structure that    has both the key and value */
  478.           char*  hv_iterkey(HE* entry, I32*    retlen);
  479.               /* Get the key from an HE    structure and also return
  480.              the length of the key string */
  481.           SV*    hv_iterval(HV*, HE* entry);
  482.               /* Return    a SV pointer to    the value of the HE
  483.              structure */
  484.           SV*    hv_iternextsv(HV*,    char** key, I32* retlen);
  485.               /* This convenience routine combines hv_iternext,
  486.              hv_iterkey, and hv_iterval.  The key and retlen
  487.              arguments are return values for the key and its
  488.              length.  The value is returned    in the SV* argument */
  489.  
  490.       If you know the name of a hash variable, you can get a
  491.       pointer to its HV by using the following:
  492.  
  493.           HV*  perl_get_hv("package::varname", FALSE);
  494.  
  495.       This returns NULL if the variable does not exist.
  496.  
  497.       The hash algorithm is    defined    in the PERL_HASH(hash, key,
  498.       klen)    macro:
  499.  
  500.           i    = klen;
  501.           hash = 0;
  502.           s    = key;
  503.           while (i--)
  504.           hash = hash *    33 + *s++;
  505.  
  506.       See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d _H_a_s_h_e_s
  507.       _a_n_d _A_r_r_a_y_s for more information on how to use    the hash
  508.       access functions on tied hashes.
  509.  
  510.       HHHHaaaasssshhhh AAAAPPPPIIII EEEExxxxtttteeeennnnssssiiiioooonnnnssss
  511.  
  512.       Beginning with version 5.004,    the following functions    are
  513.       also supported:
  514.  
  515.           HE*     hv_fetch_ent  (HV* tb, SV* key, I32 lval,    U32 hash);
  516.           HE*     hv_store_ent  (HV* tb, SV* key, SV* val, U32 hash);
  517.  
  518.           bool    hv_exists_ent (HV* tb, SV* key, U32 hash);
  519.           SV*     hv_delete_ent (HV* tb, SV* key, I32 flags, U32 hash);
  520.  
  521.           SV*     hv_iterkeysv  (HE* entry);
  522.  
  523.  
  524.  
  525.      Page 8                        (printed 10/23/98)
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  533.  
  534.  
  535.  
  536.       Note that these functions take SV* keys, which simplifies
  537.       writing of extension code that deals with hash structures.
  538.       These    functions also allow passing of    SV* keys to tie
  539.       functions without forcing you    to stringify the keys (unlike
  540.       the previous set of functions).
  541.  
  542.       They also return and accept whole hash entries (HE*),    making
  543.       their    use more efficient (since the hash number for a
  544.       particular string doesn't have to be recomputed every    time).
  545.       See the section on _A_P_I _L_I_S_T_I_N_G later in this document    for
  546.       detailed descriptions.
  547.  
  548.       The following    macros must always be used to access the
  549.       contents of hash entries.  Note that the arguments to    these
  550.       macros must be simple    variables, since they may get
  551.       evaluated more than once.  See the section on    _A_P_I _L_I_S_T_I_N_G
  552.       later    in this    document for detailed descriptions of these
  553.       macros.
  554.  
  555.           HePV(HE* he, STRLEN len)
  556.           HeVAL(HE*    he)
  557.           HeHASH(HE* he)
  558.           HeSVKEY(HE* he)
  559.           HeSVKEY_force(HE*    he)
  560.           HeSVKEY_set(HE* he, SV* sv)
  561.  
  562.       These    two lower level    macros are defined, but    must only be
  563.       used when dealing with keys that are not SV*s:
  564.  
  565.           HeKEY(HE*    he)
  566.           HeKLEN(HE* he)
  567.  
  568.       Note that both hv_store and hv_store_ent do not increment
  569.       the reference    count of the stored val, which is the caller's
  570.       responsibility.  If these functions return a NULL value, the
  571.       caller will usually have to decrement    the reference count of
  572.       val to avoid a memory    leak.
  573.  
  574.       RRRReeeeffffeeeerrrreeeennnncccceeeessss
  575.  
  576.       References are a special type    of scalar that point to    other
  577.       data types (including    references).
  578.  
  579.       To create a reference, use either of the following
  580.       functions:
  581.  
  582.           SV* newRV_inc((SV*) thing);
  583.           SV* newRV_noinc((SV*) thing);
  584.  
  585.       The thing argument can be any    of an SV*, AV*,    or HV*.     The
  586.       functions are    identical except that newRV_inc    increments the
  587.       reference count of the thing,    while newRV_noinc does not.
  588.  
  589.  
  590.  
  591.      Page 9                        (printed 10/23/98)
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  599.  
  600.  
  601.  
  602.       For historical reasons, newRV    is a synonym for newRV_inc.
  603.  
  604.       Once you have    a reference, you can use the following macro
  605.       to dereference the reference:
  606.  
  607.           SvRV(SV*)
  608.  
  609.       then call the    appropriate routines, casting the returned SV*
  610.       to either an AV* or HV*, if required.
  611.  
  612.       To determine if an SV    is a reference,    you can    use the
  613.       following macro:
  614.  
  615.           SvROK(SV*)
  616.  
  617.       To discover what type    of value the reference refers to, use
  618.       the following    macro and then check the return    value.
  619.  
  620.           SvTYPE(SvRV(SV*))
  621.  
  622.       The most useful types    that will be returned are:
  623.  
  624.           SVt_IV    Scalar
  625.           SVt_NV    Scalar
  626.           SVt_PV    Scalar
  627.           SVt_RV    Scalar
  628.           SVt_PVAV    Array
  629.           SVt_PVHV    Hash
  630.           SVt_PVCV    Code
  631.           SVt_PVGV    Glob (possible a file handle)
  632.           SVt_PVMG    Blessed    or Magical Scalar
  633.  
  634.           See the sv.h header file for more    details.
  635.  
  636.  
  637.       BBBBlllleeeesssssssseeeedddd RRRReeeeffffeeeerrrreeeennnncccceeeessss aaaannnndddd CCCCllllaaaassssssss OOOObbbbjjjjeeeeccccttttssss
  638.  
  639.       References are also used to support object-oriented
  640.       programming.    In the OO lexicon, an object is    simply a
  641.       reference that has been blessed into a package (or class).
  642.       Once blessed,    the programmer may now use the reference to
  643.       access the various methods in    the class.
  644.  
  645.       A reference can be blessed into a package with the following
  646.       function:
  647.  
  648.           SV* sv_bless(SV* sv, HV* stash);
  649.  
  650.       The sv argument must be a reference.    The stash argument
  651.       specifies which class    the reference will belong to.  See the
  652.       section on _S_t_a_s_h_e_s _a_n_d _G_l_o_b_s for information on converting
  653.       class    names into stashes.
  654.  
  655.  
  656.  
  657.      Page 10                        (printed 10/23/98)
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  665.  
  666.  
  667.  
  668.       /* Still under construction */
  669.  
  670.       Upgrades rv to reference if not already one.    Creates    new SV
  671.       for rv to point to.  If classname is non-null, the SV    is
  672.       blessed into the specified class.  SV    is returned.
  673.  
  674.           SV* newSVrv(SV* rv, char* classname);
  675.  
  676.       Copies integer or double into    an SV whose reference is rv.
  677.       SV is    blessed    if classname is    non-null.
  678.  
  679.           SV* sv_setref_iv(SV* rv, char* classname, IV iv);
  680.           SV* sv_setref_nv(SV* rv, char* classname, NV iv);
  681.  
  682.       Copies the pointer value (_t_h_e    _a_d_d_r_e_s_s, _n_o_t _t_h_e _s_t_r_i_n_g!) into
  683.       an SV    whose reference    is rv.    SV is blessed if classname is
  684.       non-null.
  685.  
  686.           SV* sv_setref_pv(SV* rv, char* classname, PV iv);
  687.  
  688.       Copies string    into an    SV whose reference is rv.  Set length
  689.       to 0 to let Perl calculate the string    length.     SV is blessed
  690.       if classname is non-null.
  691.  
  692.           SV* sv_setref_pvn(SV*    rv, char* classname, PV    iv, int    length);
  693.  
  694.       Tests    whether    the SV is blessed into the specified class.
  695.       It does not check inheritance    relationships.
  696.  
  697.           int  sv_isa(SV* sv, char* name);
  698.  
  699.       Tests    whether    the SV is a reference to a blessed object.
  700.  
  701.           int  sv_isobject(SV* sv);
  702.  
  703.       Tests    whether    the SV is derived from the specified class. SV
  704.       can be either    a reference to a blessed object    or a string
  705.       containing a class name. This    is the function    implementing
  706.       the UNIVERSAL::isa functionality.
  707.  
  708.           bool sv_derived_from(SV* sv, char* name);
  709.  
  710.       To check if you've got an object derived from    a specific
  711.       class    you have to write:
  712.  
  713.           if (sv_isobject(sv) && sv_derived_from(sv, class)) { ... }
  714.  
  715.  
  716.       CCCCrrrreeeeaaaattttiiiinnnngggg NNNNeeeewwww VVVVaaaarrrriiiiaaaabbbblllleeeessss
  717.  
  718.       To create a new Perl variable    with an    undef value which can
  719.       be accessed from your    Perl script, use the following
  720.  
  721.  
  722.  
  723.      Page 11                        (printed 10/23/98)
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  731.  
  732.  
  733.  
  734.       routines, depending on the variable type.
  735.  
  736.           SV*  perl_get_sv("package::varname", TRUE);
  737.           AV*  perl_get_av("package::varname", TRUE);
  738.           HV*  perl_get_hv("package::varname", TRUE);
  739.  
  740.       Notice the use of TRUE as the    second parameter.  The new
  741.       variable can now be set, using the routines appropriate to
  742.       the data type.
  743.  
  744.       There    are additional macros whose values may be bitwise
  745.       OR'ed    with the TRUE argument to enable certain extra
  746.       features.  Those bits    are:
  747.  
  748.           GV_ADDMULTI Marks    the variable as    multiply defined, thus preventing the
  749.               "Name    <varname> used only once: possible typo" warning.
  750.           GV_ADDWARN  Issues the warning "Had to create <varname> unexpectedly" if
  751.               the variable did not exist before the    function was called.
  752.  
  753.       If you do not    specify    a package name,    the variable is
  754.       created in the current package.
  755.  
  756.       RRRReeeeffffeeeerrrreeeennnncccceeee CCCCoooouuuunnnnttttssss aaaannnndddd MMMMoooorrrrttttaaaalllliiiittttyyyy
  757.  
  758.       Perl uses an reference count-driven garbage collection
  759.       mechanism. SVs, AVs, or HVs (xV for short in the following)
  760.       start    their life with    a reference count of 1.     If the
  761.       reference count of an    xV ever    drops to 0, then it will be
  762.       destroyed and    its memory made    available for reuse.
  763.  
  764.       This normally    doesn't    happen at the Perl level unless    a
  765.       variable is undef'ed or the last variable holding a
  766.       reference to it is changed or    overwritten.  At the internal
  767.       level, however, reference counts can be manipulated with the
  768.       following macros:
  769.  
  770.           int SvREFCNT(SV* sv);
  771.           SV* SvREFCNT_inc(SV* sv);
  772.           void SvREFCNT_dec(SV* sv);
  773.  
  774.       However, there is one    other function which manipulates the
  775.       reference count of its argument.  The    newRV_inc function,
  776.       you will recall, creates a reference to the specified
  777.       argument.  As    a side effect, it increments the argument's
  778.       reference count.  If this is not what    you want, use
  779.       newRV_noinc instead.
  780.  
  781.       For example, imagine you want    to return a reference from an
  782.       XSUB function.  Inside the XSUB routine, you create an SV
  783.       which    initially has a    reference count    of one.     Then you call
  784.       newRV_inc, passing it    the just-created SV.  This returns the
  785.       reference as a new SV, but the reference count of the    SV you
  786.  
  787.  
  788.  
  789.      Page 12                        (printed 10/23/98)
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  797.  
  798.  
  799.  
  800.       passed to newRV_inc has been incremented to two.  Now    you
  801.       return the reference from the    XSUB routine and forget    about
  802.       the SV.  But Perl hasn't!  Whenever the returned reference
  803.       is destroyed,    the reference count of the original SV is
  804.       decreased to one and nothing happens.     The SV    will hang
  805.       around without any way to access it until Perl itself
  806.       terminates.  This is a memory    leak.
  807.  
  808.       The correct procedure, then, is to use newRV_noinc instead
  809.       of newRV_inc.     Then, if and when the last reference is
  810.       destroyed, the reference count of the    SV will    go to zero and
  811.       it will be destroyed,    stopping any memory leak.
  812.  
  813.       There    are some convenience functions available that can help
  814.       with the destruction of xVs.    These functions    introduce the
  815.       concept of "mortality".  An xV that is mortal    has had    its
  816.       reference count marked to be decremented, but    not actually
  817.       decremented, until "a    short time later".  Generally the term
  818.       "short time later" means a single Perl statement, such as a
  819.       call to an XSUB function.  The actual    determinant for    when
  820.       mortal xVs have their    reference count    decremented depends on
  821.       two macros, SAVETMPS and FREETMPS.  See the _p_e_r_l_c_a_l_l manpage
  822.       and the _p_e_r_l_x_s manpage for more details on these macros.
  823.  
  824.       "Mortalization" then is at its simplest a deferred
  825.       SvREFCNT_dec.     However, if you mortalize a variable twice,
  826.       the reference    count will later be decremented    twice.
  827.  
  828.       You should be    careful    about creating mortal variables.
  829.       Strange things can happen if you make    the same value mortal
  830.       within multiple contexts, or if you make a variable mortal
  831.       multiple times.
  832.  
  833.       To create a mortal variable, use the functions:
  834.  
  835.           SV*  sv_newmortal()
  836.           SV*  sv_2mortal(SV*)
  837.           SV*  sv_mortalcopy(SV*)
  838.  
  839.       The first call creates a mortal SV, the second converts an
  840.       existing SV to a mortal SV (and thus defers a    call to
  841.       SvREFCNT_dec), and the third creates a mortal    copy of    an
  842.       existing SV.
  843.  
  844.       The mortal routines are not just for SVs -- AVs and HVs can
  845.       be made mortal by passing their address (type-casted to SV*)
  846.       to the sv_2mortal or sv_mortalcopy routines.
  847.  
  848.       SSSSttttaaaasssshhhheeeessss aaaannnndddd GGGGlllloooobbbbssss
  849.  
  850.       A "stash" is a hash that contains all    of the different
  851.       objects that are contained within a package.    Each key of
  852.  
  853.  
  854.  
  855.      Page 13                        (printed 10/23/98)
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  863.  
  864.  
  865.  
  866.       the stash is a symbol    name (shared by    all the    different
  867.       types    of objects that    have the same name), and each value in
  868.       the hash table is a GV (Glob Value).    This GV    in turn
  869.       contains references to the various objects of    that name,
  870.       including (but not limited to) the following:
  871.  
  872.           Scalar Value
  873.           Array Value
  874.           Hash Value
  875.           I/O Handle
  876.           Format
  877.           Subroutine
  878.  
  879.       There    is a single stash called "PL_defstash" that holds the
  880.       items    that exist in the "main" package.  To get at the items
  881.       in other packages, append the    string "::" to the package
  882.       name.     The items in the "Foo"    package    are in the stash
  883.       "Foo::" in PL_defstash.  The items in    the "Bar::Baz" package
  884.       are in the stash "Baz::" in "Bar::"'s    stash.
  885.  
  886.       To get the stash pointer for a particular package, use the
  887.       function:
  888.  
  889.           HV*  gv_stashpv(char* name, I32 create)
  890.           HV*  gv_stashsv(SV*, I32 create)
  891.  
  892.       The first function takes a literal string, the second    uses
  893.       the string stored in the SV.    Remember that a    stash is just
  894.       a hash table,    so you get back    an HV*.     The create flag will
  895.       create a new package if it is    set.
  896.  
  897.       The name that    gv_stash*v wants is the    name of    the package
  898.       whose    symbol table you want.    The default package is called
  899.       main.     If you    have multiply nested packages, pass their
  900.       names    to gv_stash*v, separated by :: as in the Perl language
  901.       itself.
  902.  
  903.       Alternately, if you have an SV that is a blessed reference,
  904.       you can find out the stash pointer by    using:
  905.  
  906.           HV*  SvSTASH(SvRV(SV*));
  907.  
  908.       then use the following to get    the package name itself:
  909.  
  910.           char*  HvNAME(HV*    stash);
  911.  
  912.       If you need to bless or re-bless an object you can use the
  913.       following function:
  914.  
  915.           SV*  sv_bless(SV*, HV* stash)
  916.  
  917.       where    the first argument, an SV*, must be a reference, and
  918.  
  919.  
  920.  
  921.      Page 14                        (printed 10/23/98)
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  929.  
  930.  
  931.  
  932.       the second argument is a stash.  The returned    SV* can    now be
  933.       used in the same way as any other SV.
  934.  
  935.       For more information on references and blessings, consult
  936.       the _p_e_r_l_r_e_f manpage.
  937.  
  938.       DDDDoooouuuubbbblllleeee----TTTTyyyyppppeeeedddd SSSSVVVVssss
  939.  
  940.       Scalar variables normally contain only one type of value, an
  941.       integer, double, pointer, or reference.  Perl    will
  942.       automatically    convert    the actual scalar data from the    stored
  943.       type into the    requested type.
  944.  
  945.       Some scalar variables    contain    more than one type of scalar
  946.       data.     For example, the variable $! contains either the
  947.       numeric value    of errno or its    string equivalent from either
  948.       strerror or sys_errlist[].
  949.  
  950.       To force multiple data values    into an    SV, you    must do    two
  951.       things: use the sv_set*v routines to add the additional
  952.       scalar type, then set    a flag so that Perl will believe it
  953.       contains more    than one type of data.    The four macros    to set
  954.       the flags are:
  955.  
  956.           SvIOK_on
  957.           SvNOK_on
  958.           SvPOK_on
  959.           SvROK_on
  960.  
  961.       The particular macro you must    use depends on which sv_set*v
  962.       routine you called first.  This is because every sv_set*v
  963.       routine turns    on only    the bit    for the    particular type    of
  964.       data being set, and turns off    all the    rest.
  965.  
  966.       For example, to create a new Perl variable called "dberror"
  967.       that contains    both the numeric and descriptive string    error
  968.       values, you could use    the following code:
  969.  
  970.           extern int  dberror;
  971.           extern char *dberror_list;
  972.  
  973.           SV* sv = perl_get_sv("dberror", TRUE);
  974.           sv_setiv(sv, (IV)    dberror);
  975.           sv_setpv(sv, dberror_list[dberror]);
  976.           SvIOK_on(sv);
  977.  
  978.       If the order of sv_setiv and sv_setpv    had been reversed,
  979.       then the macro SvPOK_on would    need to    be called instead of
  980.       SvIOK_on.
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.      Page 15                        (printed 10/23/98)
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  995.  
  996.  
  997.  
  998.       MMMMaaaaggggiiiicccc    VVVVaaaarrrriiiiaaaabbbblllleeeessss
  999.  
  1000.       [This    section    still under construction.  Ignore everything
  1001.       here.     Post no bills.     Everything not    permitted is
  1002.       forbidden.]
  1003.  
  1004.       Any SV may be    magical, that is, it has special features that
  1005.       a normal SV does not have.  These features are stored    in the
  1006.       SV structure in a linked list    of struct magic's, typedef'ed
  1007.       to MAGIC.
  1008.  
  1009.           struct magic {
  1010.           MAGIC*      mg_moremagic;
  1011.           MGVTBL*     mg_virtual;
  1012.           U16          mg_private;
  1013.           char          mg_type;
  1014.           U8          mg_flags;
  1015.           SV*          mg_obj;
  1016.           char*          mg_ptr;
  1017.           I32          mg_len;
  1018.           };
  1019.  
  1020.       Note this is current as of patchlevel    0, and could change at
  1021.       any time.
  1022.  
  1023.       AAAAssssssssiiiiggggnnnniiiinnnngggg MMMMaaaaggggiiiicccc
  1024.  
  1025.       Perl adds magic to an    SV using the sv_magic function:
  1026.  
  1027.           void sv_magic(SV*    sv, SV*    obj, int how, char* name, I32 namlen);
  1028.  
  1029.       The sv argument is a pointer to the SV that is to acquire a
  1030.       new magical feature.
  1031.  
  1032.       If sv    is not already magical,    Perl uses the SvUPGRADE    macro
  1033.       to set the SVt_PVMG flag for the sv.    Perl then continues by
  1034.       adding it to the beginning of    the linked list    of magical
  1035.       features.  Any prior entry of    the same type of magic is
  1036.       deleted.  Note that this can be overridden, and multiple
  1037.       instances of the same    type of    magic can be associated    with
  1038.       an SV.
  1039.  
  1040.       The name and namlen arguments    are used to associate a    string
  1041.       with the magic, typically the    name of    a variable. namlen is
  1042.       stored in the    mg_len field and if name is non-null and
  1043.       namlen >= 0 a    malloc'd copy of the name is stored in mg_ptr
  1044.       field.
  1045.  
  1046.       The sv_magic function    uses how to determine which, if    any,
  1047.       predefined "Magic Virtual Table" should be assigned to the
  1048.       mg_virtual field.  See the "Magic Virtual Table" section
  1049.       below.  The how argument is also stored in the mg_type
  1050.  
  1051.  
  1052.  
  1053.      Page 16                        (printed 10/23/98)
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1061.  
  1062.  
  1063.  
  1064.       field.
  1065.  
  1066.       The obj argument is stored in    the mg_obj field of the    MAGIC
  1067.       structure.  If it is not the same as the sv argument,    the
  1068.       reference count of the obj object is incremented.  If    it is
  1069.       the same, or if the how argument is "#", or if it is a NULL
  1070.       pointer, then    obj is merely stored, without the reference
  1071.       count    being incremented.
  1072.  
  1073.       There    is also    a function to add magic    to an HV:
  1074.  
  1075.           void hv_magic(HV *hv, GV *gv, int    how);
  1076.  
  1077.       This simply calls sv_magic and coerces the gv    argument into
  1078.       an SV.
  1079.  
  1080.       To remove the    magic from an SV, call the function
  1081.       sv_unmagic:
  1082.  
  1083.           void sv_unmagic(SV *sv, int type);
  1084.  
  1085.       The type argument should be equal to the how value when the
  1086.       SV was initially made    magical.
  1087.  
  1088.       MMMMaaaaggggiiiicccc    VVVViiiirrrrttttuuuuaaaallll    TTTTaaaabbbblllleeeessss
  1089.  
  1090.       The mg_virtual field in the MAGIC structure is a pointer to
  1091.       a MGVTBL, which is a structure of function pointers and
  1092.       stands for "Magic Virtual Table" to handle the various
  1093.       operations that might    be applied to that variable.
  1094.  
  1095.       The MGVTBL has five pointers to the following    routine    types:
  1096.  
  1097.           int  (*svt_get)(SV* sv, MAGIC* mg);
  1098.           int  (*svt_set)(SV* sv, MAGIC* mg);
  1099.           U32  (*svt_len)(SV* sv, MAGIC* mg);
  1100.           int  (*svt_clear)(SV* sv,    MAGIC* mg);
  1101.           int  (*svt_free)(SV* sv, MAGIC* mg);
  1102.  
  1103.       This MGVTBL structure    is set at compile-time in perl.h and
  1104.       there    are currently 19 types (or 21 with overloading turned
  1105.       on).    These different    structures contain pointers to various
  1106.       routines that    perform    additional actions depending on    which
  1107.       function is being called.
  1108.  
  1109.           Function pointer      Action taken
  1110.           ----------------      ------------
  1111.           svt_get          Do something after the value of the SV is retrieved.
  1112.           svt_set          Do something after the SV is assigned    a value.
  1113.           svt_len          Report on the    SV's length.
  1114.           svt_clear          Clear    something the SV represents.
  1115.           svt_free          Free any extra storage associated with the SV.
  1116.  
  1117.  
  1118.  
  1119.      Page 17                        (printed 10/23/98)
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1127.  
  1128.  
  1129.  
  1130.       For instance,    the MGVTBL structure called vtbl_sv (which
  1131.       corresponds to an mg_type of '\0') contains:
  1132.  
  1133.           {    magic_get, magic_set, magic_len, 0, 0 }
  1134.  
  1135.       Thus,    when an    SV is determined to be magical and of type
  1136.       '\0',    if a get operation is being performed, the routine
  1137.       magic_get is called.    All the    various    routines for the
  1138.       various magical types    begin with magic_.
  1139.  
  1140.       The current kinds of Magic Virtual Tables are:
  1141.  
  1142.           mg_type  MGVTBL           Type    of magic
  1143.           -------  ------           ----------------------------
  1144.           \0       vtbl_sv           Special scalar variable
  1145.           A           vtbl_amagic       %OVERLOAD hash
  1146.           a           vtbl_amagicelem       %OVERLOAD hash element
  1147.           c           (none)           Holds overload table    (AMT) on stash
  1148.           B           vtbl_bm           Boyer-Moore (fast string search)
  1149.           E           vtbl_env           %ENV    hash
  1150.           e           vtbl_envelem       %ENV    hash element
  1151.           f           vtbl_fm           Formline ('compiled'    format)
  1152.           g           vtbl_mglob       m//g    target / study()ed string
  1153.           I           vtbl_isa           @ISA    array
  1154.           i           vtbl_isaelem       @ISA    array element
  1155.           k           vtbl_nkeys       scalar(keys()) lvalue
  1156.           L           (none)           Debugger %_<filename
  1157.           l           vtbl_dbline       Debugger %_<filename    element
  1158.           o           vtbl_collxfrm       Locale transformation
  1159.           P           vtbl_pack       Tied    array or hash
  1160.           p           vtbl_packelem       Tied    array or hash element
  1161.           q           vtbl_packelem       Tied    scalar or handle
  1162.           S           vtbl_sig           %SIG    hash
  1163.           s           vtbl_sigelem       %SIG    hash element
  1164.           t           vtbl_taint       Taintedness
  1165.           U           vtbl_uvar       Available for use by    extensions
  1166.           v           vtbl_vec           vec() lvalue
  1167.           x           vtbl_substr       substr() lvalue
  1168.           y           vtbl_defelem       Shadow "foreach" iterator variable /
  1169.                         smart parameter vivification
  1170.           *           vtbl_glob       GV (typeglob)
  1171.           #           vtbl_arylen       Array length    ($#ary)
  1172.           .           vtbl_pos           pos() lvalue
  1173.           ~           (none)           Available for use by    extensions
  1174.  
  1175.       When an uppercase and    lowercase letter both exist in the
  1176.       table, then the uppercase letter is used to represent    some
  1177.       kind of composite type (a list or a hash), and the lowercase
  1178.       letter is used to represent an element of that composite
  1179.       type.
  1180.  
  1181.       The '~' and 'U' magic    types are defined specifically for use
  1182.  
  1183.  
  1184.  
  1185.      Page 18                        (printed 10/23/98)
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1193.  
  1194.  
  1195.  
  1196.       by extensions    and will not be    used by    perl itself.
  1197.       Extensions can use '~' magic to 'attach' private information
  1198.       to variables (typically objects).  This is especially    useful
  1199.       because there    is no way for normal perl code to corrupt this
  1200.       private information (unlike using extra elements of a    hash
  1201.       object).
  1202.  
  1203.       Similarly, 'U' magic can be used much    like _t_i_e() to call a C
  1204.       function any time a scalar's value is    used or    changed.  The
  1205.       MAGIC's mg_ptr field points to a ufuncs structure:
  1206.  
  1207.           struct ufuncs {
  1208.           I32 (*uf_val)(IV, SV*);
  1209.           I32 (*uf_set)(IV, SV*);
  1210.           IV uf_index;
  1211.           };
  1212.  
  1213.       When the SV is read from or written to, the uf_val or    uf_set
  1214.       function will    be called with uf_index    as the first arg and a
  1215.       pointer to the SV as the second.
  1216.  
  1217.       Note that because multiple extensions    may be using '~' or
  1218.       'U' magic, it    is important for extensions to take extra care
  1219.       to avoid conflict.  Typically    only using the magic on
  1220.       objects blessed into the same    class as the extension is
  1221.       sufficient.  For '~' magic, it may also be appropriate to
  1222.       add an I32 'signature' at the    top of the private data    area
  1223.       and check that.
  1224.  
  1225.       Also note that the sv_set*() and sv_cat*() functions
  1226.       described earlier do nnnnooootttt invoke 'set'    magic on their
  1227.       targets.  This must be done by the user either by calling
  1228.       the SvSETMAGIC() macro after calling these functions,    or by
  1229.       using    one of the sv_set*_mg()    or sv_cat*_mg()    functions.
  1230.       Similarly, generic C code must call the SvGETMAGIC() macro
  1231.       to invoke any    'get' magic if they use    an SV obtained from
  1232.       external sources in functions    that don't handle magic.  the
  1233.       section on _A_P_I _L_I_S_T_I_N_G later in this document    identifies
  1234.       such functions.  For example,    calls to the sv_cat*()
  1235.       functions typically need to be followed by SvSETMAGIC(), but
  1236.       they don't need a prior SvGETMAGIC() since their
  1237.       implementation handles 'get' magic.
  1238.  
  1239.       FFFFiiiinnnnddddiiiinnnngggg MMMMaaaaggggiiiicccc
  1240.  
  1241.           MAGIC* mg_find(SV*, int type); /*    Finds the magic    pointer    of that    type */
  1242.  
  1243.       This routine returns a pointer to the    MAGIC structure    stored
  1244.       in the SV.  If the SV    does not have that magical feature,
  1245.       NULL is returned.  Also, if the SV is    not of type SVt_PVMG,
  1246.       Perl may core    dump.
  1247.  
  1248.  
  1249.  
  1250.  
  1251.      Page 19                        (printed 10/23/98)
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1259.  
  1260.  
  1261.  
  1262.           int mg_copy(SV* sv, SV* nsv, char* key, STRLEN klen);
  1263.  
  1264.       This routine checks to see what types    of magic sv has.  If
  1265.       the mg_type field is an uppercase letter, then the mg_obj is
  1266.       copied to nsv, but the mg_type field is changed to be    the
  1267.       lowercase letter.
  1268.  
  1269.       UUUUnnnnddddeeeerrrrssssttttaaaannnnddddiiiinnnngggg    tttthhhheeee MMMMaaaaggggiiiicccc ooooffff TTTTiiiieeeedddd HHHHaaaasssshhhheeeessss aaaannnndddd AAAArrrrrrrraaaayyyyssss
  1270.  
  1271.       Tied hashes and arrays are magical beasts of the 'P' magic
  1272.       type.
  1273.  
  1274.       WARNING: As of the 5.004 release, proper usage of the    array
  1275.       and hash access functions requires understanding a few
  1276.       caveats.  Some of these caveats are actually considered bugs
  1277.       in the API, to be fixed in later releases, and are bracketed
  1278.       with [MAYCHANGE] below. If you find yourself actually
  1279.       applying such    information in this section, be    aware that the
  1280.       behavior may change in the future, umm, without warning.
  1281.  
  1282.       The av_store function, when given a tied array argument,
  1283.       merely copies    the magic of the array onto the    value to be
  1284.       "stored", using mg_copy.  It may also    return NULL,
  1285.       indicating that the value did    not actually need to be    stored
  1286.       in the array.     [MAYCHANGE] After a call to av_store on a
  1287.       tied array, the caller will usually need to call mg_set(val)
  1288.       to actually invoke the perl level "STORE" method on the
  1289.       TIEARRAY object.  If av_store    did return NULL, a call    to
  1290.       SvREFCNT_dec(val) will also be usually necessary to avoid a
  1291.       memory leak. [/MAYCHANGE]
  1292.  
  1293.       The previous paragraph is applicable verbatim    to tied    hash
  1294.       access using the hv_store and    hv_store_ent functions as
  1295.       well.
  1296.  
  1297.       av_fetch and the corresponding hash functions    hv_fetch and
  1298.       hv_fetch_ent actually    return an undefined mortal value whose
  1299.       magic    has been initialized using mg_copy.  Note the value so
  1300.       returned does    not need to be deallocated, as it is already
  1301.       mortal.  [MAYCHANGE] But you will need to call mg_get() on
  1302.       the returned value in    order to actually invoke the perl
  1303.       level    "FETCH"    method on the underlying TIE object.
  1304.       Similarly, you may also call mg_set()    on the return value
  1305.       after    possibly assigning a suitable value to it using
  1306.       sv_setsv,  which will    invoke the "STORE" method on the TIE
  1307.       object. [/MAYCHANGE]
  1308.  
  1309.       [MAYCHANGE] In other words, the array    or hash    fetch/store
  1310.       functions don't really fetch and store actual    values in the
  1311.       case of tied arrays and hashes.  They    merely call mg_copy to
  1312.       attach magic to the values that were meant to    be "stored" or
  1313.       "fetched".  Later calls to mg_get and    mg_set actually    do the
  1314.  
  1315.  
  1316.  
  1317.      Page 20                        (printed 10/23/98)
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1325.  
  1326.  
  1327.  
  1328.       job of invoking the TIE methods on the underlying objects.
  1329.       Thus the magic mechanism currently implements    a kind of lazy
  1330.       access to arrays and hashes.
  1331.  
  1332.       Currently (as    of perl    version    5.004),    use of the hash    and
  1333.       array    access functions requires the user to be aware of
  1334.       whether they are operating on    "normal" hashes    and arrays, or
  1335.       on their tied    variants.  The API may be changed to provide
  1336.       more transparent access to both tied and normal data types
  1337.       in future versions.  [/MAYCHANGE]
  1338.  
  1339.       You would do well to understand that the TIEARRAY and
  1340.       TIEHASH interfaces are mere sugar to invoke some perl    method
  1341.       calls    while using the    uniform    hash and array syntax.    The
  1342.       use of this sugar imposes some overhead (typically about two
  1343.       to four extra    opcodes    per FETCH/STORE    operation, in addition
  1344.       to the creation of all the mortal variables required to
  1345.       invoke the methods).    This overhead will be comparatively
  1346.       small    if the TIE methods are themselves substantial, but if
  1347.       they are only    a few statements long, the overhead will not
  1348.       be insignificant.
  1349.  
  1350.       LLLLooooccccaaaalllliiiizzzziiiinnnngggg cccchhhhaaaannnnggggeeeessss
  1351.  
  1352.       Perl has a very handy    construction
  1353.  
  1354.         {
  1355.           local $var = 2;
  1356.           ...
  1357.         }
  1358.  
  1359.       This construction is _a_p_p_r_o_x_i_m_a_t_e_l_y equivalent    to
  1360.  
  1361.         {
  1362.           my $oldvar = $var;
  1363.           $var = 2;
  1364.           ...
  1365.           $var = $oldvar;
  1366.         }
  1367.  
  1368.       The biggest difference is that the first construction    would
  1369.       reinstate the    initial    value of $var, irrespective of how
  1370.       control exits    the block: goto, return, die/eval etc. It is a
  1371.       little bit more efficient as well.
  1372.  
  1373.       There    is a way to achieve a similar task from    C via Perl
  1374.       API: create a    _p_s_e_u_d_o-_b_l_o_c_k, and arrange for some changes to
  1375.       be automatically undone at the end of    it, either explicit,
  1376.       or via a non-local exit (via _d_i_e()). A _b_l_o_c_k-like construct
  1377.       is created by    a pair of ENTER/LEAVE macros (see the section
  1378.       on _E_X_A_M_P_L_E/"_R_e_t_u_r_n_i_n_g    _a _S_c_a_l_a_r in the    _p_e_r_l_c_a_l_l manpage).
  1379.       Such a construct may be created specially for    some important
  1380.  
  1381.  
  1382.  
  1383.      Page 21                        (printed 10/23/98)
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1391.  
  1392.  
  1393.  
  1394.       localized task, or an    existing one (like boundaries of
  1395.       enclosing Perl subroutine/block, or an existing pair for
  1396.       freeing TMPs)    may be used. (In the second case the overhead
  1397.       of additional    localization must be almost negligible.) Note
  1398.       that any XSUB    is automatically enclosed in an    ENTER/LEAVE
  1399.       pair.
  1400.  
  1401.       Inside such a    _p_s_e_u_d_o-_b_l_o_c_k the following service is
  1402.       available:
  1403.  
  1404.       SAVEINT(int i)
  1405.  
  1406.       SAVEIV(IV i)
  1407.  
  1408.       SAVEI32(I32 i)
  1409.  
  1410.       SAVELONG(long    i)
  1411.            These macros arrange things to restore the value    of
  1412.            integer variable    i at the end of    enclosing _p_s_e_u_d_o-
  1413.            _b_l_o_c_k.
  1414.  
  1415.       SAVESPTR(s)
  1416.  
  1417.       SAVEPPTR(p)
  1418.            These macros arrange things to restore the value    of
  1419.            pointers    s and p. s must    be a pointer of    a type which
  1420.            survives    conversion to SV* and back, p should be    able
  1421.            to survive conversion to    char* and back.
  1422.  
  1423.       SAVEFREESV(SV    *sv)
  1424.            The refcount of sv would    be decremented at the end of
  1425.            _p_s_e_u_d_o-_b_l_o_c_k. This is similar to    sv_2mortal, which
  1426.            should (?) be used instead.
  1427.  
  1428.       SAVEFREEOP(OP    *op)
  1429.            The OP *    is _o_p__f_r_e_e()ed at the end of _p_s_e_u_d_o-_b_l_o_c_k.
  1430.  
  1431.       SAVEFREEPV(p)
  1432.            The chunk of memory which is pointed to by p is
  1433.            _S_a_f_e_f_r_e_e()ed at the end of _p_s_e_u_d_o-_b_l_o_c_k.
  1434.  
  1435.       SAVECLEARSV(SV *sv)
  1436.            Clears a    slot in    the current scratchpad which
  1437.            corresponds to sv at the    end of _p_s_e_u_d_o-_b_l_o_c_k.
  1438.  
  1439.       SAVEDELETE(HV    *hv, char *key,    I32 length)
  1440.            The key key of hv is deleted at the end of _p_s_e_u_d_o-
  1441.            _b_l_o_c_k. The string pointed to by key is _S_a_f_e_f_r_e_e()ed.
  1442.            If one has a _k_e_y    in short-lived storage,    the
  1443.            corresponding string may    be reallocated like this:
  1444.  
  1445.          SAVEDELETE(PL_defstash, savepv(tmpbuf), strlen(tmpbuf));
  1446.  
  1447.  
  1448.  
  1449.      Page 22                        (printed 10/23/98)
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1457.  
  1458.  
  1459.  
  1460.       SAVEDESTRUCTOR(f,p)
  1461.            At the end of _p_s_e_u_d_o-_b_l_o_c_k the function f is called
  1462.            with the    only argument (of type void*) p.
  1463.  
  1464.       SAVESTACK_POS()
  1465.            The current offset on the Perl internal stack (cf. SP)
  1466.            is restored at the end of _p_s_e_u_d_o-_b_l_o_c_k.
  1467.  
  1468.       The following    API list contains functions, thus one needs to
  1469.       provide pointers to the modifiable data explicitly (either C
  1470.       pointers, or Perlish GV *s).    Where the above    macros take
  1471.       int, a similar function takes    int *.
  1472.  
  1473.       SV* save_scalar(GV *gv)
  1474.            Equivalent to Perl code local $gv.
  1475.  
  1476.       AV* save_ary(GV *gv)
  1477.  
  1478.       HV* save_hash(GV *gv)
  1479.            Similar to save_scalar, but localize @gv    and %gv.
  1480.  
  1481.       void save_item(SV *item)
  1482.            Duplicates the current value of SV, on the exit from
  1483.            the current ENTER/LEAVE _p_s_e_u_d_o-_b_l_o_c_k will restore the
  1484.            value of    SV using the stored value.
  1485.  
  1486.       void save_list(SV **sarg, I32    maxsarg)
  1487.            A variant of save_item which takes multiple arguments
  1488.            via an array sarg of SV*    of length maxsarg.
  1489.  
  1490.       SV* save_svref(SV **sptr)
  1491.            Similar to save_scalar, but will    reinstate a SV *.
  1492.  
  1493.       void save_aptr(AV **aptr)
  1494.  
  1495.       void save_hptr(HV **hptr)
  1496.            Similar to save_svref, but localize AV *    and HV *.
  1497.  
  1498.       The Alias module implements localization of the basic    types
  1499.       within the _c_a_l_l_e_r'_s _s_c_o_p_e.  People who are interested    in how
  1500.       to localize things in    the containing scope should take a
  1501.       look there too.
  1502.  
  1503.      SSSSuuuubbbbrrrroooouuuuttttiiiinnnneeeessss
  1504.       XXXXSSSSUUUUBBBBssss    aaaannnndddd tttthhhheeee    AAAArrrrgggguuuummmmeeeennnntttt SSSSttttaaaacccckkkk
  1505.  
  1506.       The XSUB mechanism is    a simple way for Perl programs to
  1507.       access C subroutines.     An XSUB routine will have a stack
  1508.       that contains    the arguments from the Perl program, and a way
  1509.       to map from the Perl data structures to a C equivalent.
  1510.  
  1511.       The stack arguments are accessible through the ST(n) macro,
  1512.  
  1513.  
  1514.  
  1515.      Page 23                        (printed 10/23/98)
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1523.  
  1524.  
  1525.  
  1526.       which    returns    the n'th stack argument.  Argument 0 is    the
  1527.       first    argument passed    in the Perl subroutine call.  These
  1528.       arguments are    SV*, and can be    used anywhere an SV* is    used.
  1529.  
  1530.       Most of the time, output from    the C routine can be handled
  1531.       through use of the RETVAL and    OUTPUT directives.  However,
  1532.       there    are some cases where the argument stack    is not already
  1533.       long enough to handle    all the    return values.    An example is
  1534.       the POSIX _t_z_n_a_m_e() call, which takes no arguments, but
  1535.       returns two, the local time zone's standard and summer time
  1536.       abbreviations.
  1537.  
  1538.       To handle this situation, the    PPCODE directive is used and
  1539.       the stack is extended    using the macro:
  1540.  
  1541.           EXTEND(SP, num);
  1542.  
  1543.       where    SP is the macro    that represents    the local copy of the
  1544.       stack    pointer, and num is the    number of elements the stack
  1545.       should be extended by.
  1546.  
  1547.       Now that there is room on the    stack, values can be pushed on
  1548.       it using the macros to push IVs, doubles, strings, and SV
  1549.       pointers respectively:
  1550.  
  1551.           PUSHi(IV)
  1552.           PUSHn(double)
  1553.           PUSHp(char*, I32)
  1554.           PUSHs(SV*)
  1555.  
  1556.       And now the Perl program calling tzname, the two values will
  1557.       be assigned as in:
  1558.  
  1559.           ($standard_abbrev, $summer_abbrev) = POSIX::tzname;
  1560.  
  1561.       An alternate (and possibly simpler) method to    pushing    values
  1562.       on the stack is to use the macros:
  1563.  
  1564.           XPUSHi(IV)
  1565.           XPUSHn(double)
  1566.           XPUSHp(char*, I32)
  1567.           XPUSHs(SV*)
  1568.  
  1569.       These    macros automatically adjust the    stack for you, if
  1570.       needed.  Thus, you do    not need to call EXTEND    to extend the
  1571.       stack.
  1572.  
  1573.       For more information,    consult    the _p_e_r_l_x_s manpage and the
  1574.       _p_e_r_l_x_s_t_u_t manpage.
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.      Page 24                        (printed 10/23/98)
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1589.  
  1590.  
  1591.  
  1592.       CCCCaaaalllllllliiiinnnngggg PPPPeeeerrrrllll RRRRoooouuuuttttiiiinnnneeeessss    ffffrrrroooommmm wwwwiiiitttthhhhiiiinnnn CCCC PPPPrrrrooooggggrrrraaaammmmssss
  1593.  
  1594.       There    are four routines that can be used to call a Perl
  1595.       subroutine from within a C program.  These four are:
  1596.  
  1597.           I32  perl_call_sv(SV*, I32);
  1598.           I32  perl_call_pv(char*, I32);
  1599.           I32  perl_call_method(char*, I32);
  1600.           I32  perl_call_argv(char*, I32, register char**);
  1601.  
  1602.       The routine most often used is perl_call_sv.    The SV*
  1603.       argument contains either the name of the Perl    subroutine to
  1604.       be called, or    a reference to the subroutine.    The second
  1605.       argument consists of flags that control the context in which
  1606.       the subroutine is called, whether or not the subroutine is
  1607.       being    passed arguments, how errors should be trapped,    and
  1608.       how to treat return values.
  1609.  
  1610.       All four routines return the number of arguments that    the
  1611.       subroutine returned on the Perl stack.
  1612.  
  1613.       When using any of these routines (except perl_call_argv),
  1614.       the programmer must manipulate the Perl stack.  These
  1615.       include the following    macros and functions:
  1616.  
  1617.           dSP
  1618.           SP
  1619.           PUSHMARK()
  1620.           PUTBACK
  1621.           SPAGAIN
  1622.           ENTER
  1623.           SAVETMPS
  1624.           FREETMPS
  1625.           LEAVE
  1626.           XPUSH*()
  1627.           POP*()
  1628.  
  1629.       For a    detailed description of    calling    conventions from C to
  1630.       Perl,    consult    the _p_e_r_l_c_a_l_l manpage.
  1631.  
  1632.       MMMMeeeemmmmoooorrrryyyy AAAAllllllllooooccccaaaattttiiiioooonnnn
  1633.  
  1634.       It is    suggested that you use the version of malloc that is
  1635.       distributed with Perl.  It keeps pools of various sizes of
  1636.       unallocated memory in    order to satisfy allocation requests
  1637.       more quickly.     However, on some platforms, it    may cause
  1638.       spurious malloc or free errors.
  1639.  
  1640.           New(x, pointer, number, type);
  1641.           Newc(x, pointer, number, type, cast);
  1642.           Newz(x, pointer, number, type);
  1643.  
  1644.  
  1645.  
  1646.  
  1647.      Page 25                        (printed 10/23/98)
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1655.  
  1656.  
  1657.  
  1658.       These    three macros are used to initially allocate memory.
  1659.  
  1660.       The first argument x was a "magic cookie" that was used to
  1661.       keep track of    who called the macro, to help when debugging
  1662.       memory problems.  However, the current code makes no use of
  1663.       this feature (most Perl developers now use run-time memory
  1664.       checkers), so    this argument can be any number.
  1665.  
  1666.       The second argument pointer should be    the name of a variable
  1667.       that will point to the newly allocated memory.
  1668.  
  1669.       The third and    fourth arguments number    and type specify how
  1670.       many of the specified    type of    data structure should be
  1671.       allocated.  The argument type    is passed to sizeof.  The
  1672.       final    argument to Newc, cast,    should be used if the pointer
  1673.       argument is different    from the type argument.
  1674.  
  1675.       Unlike the New and Newc macros, the Newz macro calls memzero
  1676.       to zero out all the newly allocated memory.
  1677.  
  1678.           Renew(pointer, number, type);
  1679.           Renewc(pointer, number, type, cast);
  1680.           Safefree(pointer)
  1681.  
  1682.       These    three macros are used to change    a memory buffer    size
  1683.       or to    free a piece of    memory no longer needed.  The
  1684.       arguments to Renew and Renewc    match those of New and Newc
  1685.       with the exception of    not needing the    "magic cookie"
  1686.       argument.
  1687.  
  1688.           Move(source, dest, number, type);
  1689.           Copy(source, dest, number, type);
  1690.           Zero(dest, number, type);
  1691.  
  1692.       These    three macros are used to move, copy, or    zero out
  1693.       previously allocated memory.    The source and dest arguments
  1694.       point    to the source and destination starting points.    Perl
  1695.       will move, copy, or zero out number instances    of the size of
  1696.       the type data    structure (using the sizeof function).
  1697.  
  1698.       PPPPeeeerrrrllllIIIIOOOO
  1699.  
  1700.       The most recent development releases of Perl has been
  1701.       experimenting    with removing Perl's dependency    on the
  1702.       "normal" standard I/O    suite and allowing other stdio
  1703.       implementations to be    used.  This involves creating a    new
  1704.       abstraction layer that then calls whichever implementation
  1705.       of stdio Perl    was compiled with.  All    XSUBs should now use
  1706.       the functions    in the PerlIO abstraction layer    and not    make
  1707.       any assumptions about    what kind of stdio is being used.
  1708.  
  1709.       For a    complete description of    the PerlIO abstraction,
  1710.  
  1711.  
  1712.  
  1713.      Page 26                        (printed 10/23/98)
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1721.  
  1722.  
  1723.  
  1724.       consult the _p_e_r_l_a_p_i_o manpage.
  1725.  
  1726.       PPPPuuuuttttttttiiiinnnngggg aaaa CCCC vvvvaaaalllluuuueeee oooonnnn PPPPeeeerrrrllll ssssttttaaaacccckkkk
  1727.  
  1728.       A lot    of opcodes (this is an elementary operation in the
  1729.       internal perl    stack machine) put an SV* on the stack.
  1730.       However, as an optimization the corresponding    SV is
  1731.       (usually) not    recreated each time. The opcodes reuse
  1732.       specially assigned SVs (_t_a_r_g_e_ts) which are (as a corollary)
  1733.       not constantly freed/created.
  1734.  
  1735.       Each of the targets is created only once (but    see the
  1736.       section on _S_c_r_a_t_c_h_p_a_d_s _a_n_d _r_e_c_u_r_s_i_o_n below), and when    an
  1737.       opcode needs to put an integer, a double, or a string    on
  1738.       stack, it just sets the corresponding    parts of its _t_a_r_g_e_t
  1739.       and puts the _t_a_r_g_e_t on stack.
  1740.  
  1741.       The macro to put this    target on stack    is PUSHTARG, and it is
  1742.       directly used    in some    opcodes, as well as indirectly in
  1743.       zillions of others, which use    it via (X)PUSH[pni].
  1744.  
  1745.       SSSSccccrrrraaaattttcccchhhhppppaaaaddddssss
  1746.  
  1747.       The question remains on when the SVs which are _t_a_r_g_e_ts for
  1748.       opcodes are created. The answer is that they are created
  1749.       when the current unit    -- a subroutine    or a file (for opcodes
  1750.       for statements outside of subroutines) -- is compiled.
  1751.       During this time a special anonymous Perl array is created,
  1752.       which    is called a scratchpad for the current unit.
  1753.  
  1754.       A scratchpad keeps SVs which are lexicals for    the current
  1755.       unit and are targets for opcodes. One    can deduce that    an SV
  1756.       lives    on a scratchpad    by looking on its flags: lexicals have
  1757.       SVs_PADMY set, and _t_a_r_g_e_ts have SVs_PADTMP set.
  1758.  
  1759.       The correspondence between OPs and _t_a_r_g_e_ts is    not 1-to-1.
  1760.       Different OPs    in the compile tree of the unit    can use    the
  1761.       same target, if this would not conflict with the expected
  1762.       life of the temporary.
  1763.  
  1764.       SSSSccccrrrraaaattttcccchhhhppppaaaaddddssss aaaannnndddd rrrreeeeccccuuuurrrrssssiiiioooonnnn
  1765.  
  1766.       In fact it is    not 100% true that a compiled unit contains a
  1767.       pointer to the scratchpad AV.    In fact    it contains a pointer
  1768.       to an    AV of (initially) one element, and this    element    is the
  1769.       scratchpad AV. Why do    we need    an extra level of indirection?
  1770.  
  1771.       The answer is    rrrreeeeccccuuuurrrrssssiiiioooonnnn, and maybe (sometime soon) tttthhhhrrrreeeeaaaaddddssss.
  1772.       Both these can create    several    execution pointers going into
  1773.       the same subroutine. For the subroutine-child    not write over
  1774.       the temporaries for the subroutine-parent (lifespan of which
  1775.       covers the call to the child), the parent and    the child
  1776.  
  1777.  
  1778.  
  1779.      Page 27                        (printed 10/23/98)
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1787.  
  1788.  
  1789.  
  1790.       should have different    scratchpads. (_A_n_d the lexicals should
  1791.       be separate anyway!)
  1792.  
  1793.       So each subroutine is    born with an array of scratchpads (of
  1794.       length 1).  On each entry to the subroutine it is checked
  1795.       that the current depth of the    recursion is not more than the
  1796.       length of this array,    and if it is, new scratchpad is
  1797.       created and pushed into the array.
  1798.  
  1799.       The _t_a_r_g_e_ts on this scratchpad are undefs, but they are
  1800.       already marked with correct flags.
  1801.  
  1802.      CCCCoooommmmppppiiiilllleeeedddd ccccooooddddeeee
  1803.       CCCCooooddddeeee ttttrrrreeeeeeee
  1804.  
  1805.       Here we describe the internal    form your code is converted to
  1806.       by Perl. Start with a    simple example:
  1807.  
  1808.         $a = $b + $c;
  1809.  
  1810.       This is converted to a tree similar to this one:
  1811.  
  1812.                assign-to
  1813.              /         \
  1814.             +          $a
  1815.           /   \
  1816.         $b     $c
  1817.  
  1818.       (but slightly    more complicated).  This tree reflects the way
  1819.       Perl parsed your code, but has nothing to do with the
  1820.       execution order.  There is an    additional "thread" going
  1821.       through the nodes of the tree    which shows the    order of
  1822.       execution of the nodes.  In our simplified example above it
  1823.       looks    like:
  1824.  
  1825.            $b ---> $c ---> + ---> $a ---> assign-to
  1826.  
  1827.       But with the actual compile tree for $a = $b + $c it is
  1828.       different:  some nodes _o_p_t_i_m_i_z_e_d _a_w_a_y.  As a corollary,
  1829.       though the actual tree contains more nodes than our
  1830.       simplified example, the execution order is the same as in
  1831.       our example.
  1832.  
  1833.       EEEExxxxaaaammmmiiiinnnniiiinnnngggg tttthhhheeee    ttttrrrreeeeeeee
  1834.  
  1835.       If you have your perl    compiled for debugging (usually    done
  1836.       with -D optimize=-g on Configure command line), you may
  1837.       examine the compiled tree by specifying -Dx on the Perl
  1838.       command line.     The output takes several lines    per node, and
  1839.       for $b+$c it looks like this:
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.      Page 28                        (printed 10/23/98)
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1853.  
  1854.  
  1855.  
  1856.           5          TYPE = add  ===> 6
  1857.               TARG = 1
  1858.               FLAGS    = (SCALAR,KIDS)
  1859.               {
  1860.                   TYPE = null  ===>    (4)
  1861.                 (was rv2sv)
  1862.                   FLAGS = (SCALAR,KIDS)
  1863.                   {
  1864.           3              TYPE = gvsv  ===> 4
  1865.                   FLAGS    = (SCALAR)
  1866.                   GV = main::b
  1867.                   }
  1868.               }
  1869.               {
  1870.                   TYPE = null  ===>    (5)
  1871.                 (was rv2sv)
  1872.                   FLAGS = (SCALAR,KIDS)
  1873.                   {
  1874.           4              TYPE = gvsv  ===> 5
  1875.                   FLAGS    = (SCALAR)
  1876.                   GV = main::c
  1877.                   }
  1878.               }
  1879.  
  1880.       This tree has    5 nodes    (one per TYPE specifier), only 3 of
  1881.       them are not optimized away (one per number in the left
  1882.       column).  The    immediate children of the given    node
  1883.       correspond to    {} pairs on the    same level of indentation,
  1884.       thus this listing corresponds    to the tree:
  1885.  
  1886.                  add
  1887.                /     \
  1888.              null     null
  1889.               |      |
  1890.              gvsv     gvsv
  1891.  
  1892.       The execution    order is indicated by ===> marks, thus it is 3
  1893.       4 5 6    (node 6    is not included    into above listing), i.e.,
  1894.       gvsv gvsv add    whatever.
  1895.  
  1896.       CCCCoooommmmppppiiiilllleeee ppppaaaassssssss 1111:::: cccchhhheeeecccckkkk    rrrroooouuuuttttiiiinnnneeeessss
  1897.  
  1898.       The tree is created by the _p_s_e_u_d_o-_c_o_m_p_i_l_e_r while yacc    code
  1899.       feeds    it the constructions it    recognizes. Since yacc works
  1900.       bottom-up, so    does the first pass of perl compilation.
  1901.  
  1902.       What makes this pass interesting for perl developers is that
  1903.       some optimization may    be performed on    this pass.  This is
  1904.       optimization by so-called _c_h_e_c_k _r_o_u_t_i_n_e_s.  The
  1905.       correspondence between node names and    corresponding check
  1906.       routines is described    in _o_p_c_o_d_e._p_l (do not forget to run
  1907.       make regen_headers if    you modify this    file).
  1908.  
  1909.  
  1910.  
  1911.      Page 29                        (printed 10/23/98)
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1919.  
  1920.  
  1921.  
  1922.       A check routine is called when the node is fully constructed
  1923.       except for the execution-order thread.  Since    at this    time
  1924.       there    are no back-links to the currently constructed node,
  1925.       one can do most any operation    to the top-level node,
  1926.       including freeing it and/or creating new nodes above/below
  1927.       it.
  1928.  
  1929.       The check routine returns the    node which should be inserted
  1930.       into the tree    (if the    top-level node was not modified, check
  1931.       routine returns its argument).
  1932.  
  1933.       By convention, check routines    have names ck_*. They are
  1934.       usually called from new*OP subroutines (or convert) (which
  1935.       in turn are called from _p_e_r_l_y._y).
  1936.  
  1937.       CCCCoooommmmppppiiiilllleeee ppppaaaassssssss 1111aaaa:::: ccccoooonnnnssssttttaaaannnntttt ffffoooollllddddiiiinnnngggg
  1938.  
  1939.       Immediately after the    check routine is called    the returned
  1940.       node is checked for being compile-time executable.  If it is
  1941.       (the value is    judged to be constant) it is immediately
  1942.       executed, and    a _c_o_n_s_t_a_n_t node    with the "return value"    of the
  1943.       corresponding    subtree    is substituted instead.     The subtree
  1944.       is deleted.
  1945.  
  1946.       If constant folding was not performed, the execution-order
  1947.       thread is created.
  1948.  
  1949.       CCCCoooommmmppppiiiilllleeee ppppaaaassssssss 2222:::: ccccoooonnnntttteeeexxxxtttt pppprrrrooooppppaaaaggggaaaattttiiiioooonnnn
  1950.  
  1951.       When a context for a part of compile tree is known, it is
  1952.       propagated down through the tree.  At    this time the context
  1953.       can have 5 values (instead of    2 for runtime context):    void,
  1954.       boolean, scalar, list, and lvalue.  In contrast with the
  1955.       pass 1 this pass is processed    from top to bottom: a node's
  1956.       context determines the context for its children.
  1957.  
  1958.       Additional context-dependent optimizations are performed at
  1959.       this time.  Since at this moment the compile tree contains
  1960.       back-references (via "thread"    pointers), nodes cannot    be
  1961.       _f_r_e_e()d now.    To allow optimized-away    nodes at this stage,
  1962.       such nodes are _n_u_l_l()ified instead of    _f_r_e_e()ing (i.e.    their
  1963.       type is changed to OP_NULL).
  1964.  
  1965.       CCCCoooommmmppppiiiilllleeee ppppaaaassssssss 3333:::: ppppeeeeeeeepppphhhhoooolllleeee ooooppppttttiiiimmmmiiiizzzzaaaattttiiiioooonnnn
  1966.  
  1967.       After    the compile tree for a subroutine (or for an eval or a
  1968.       file)    is created, an additional pass over the    code is
  1969.       performed. This pass is neither top-down or bottom-up, but
  1970.       in the execution order (with additional complications    for
  1971.       conditionals).  These    optimizations are done in the
  1972.       subroutine _p_e_e_p().  Optimizations performed at this stage
  1973.       are subject to the same restrictions as in the pass 2.
  1974.  
  1975.  
  1976.  
  1977.      Page 30                        (printed 10/23/98)
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  1985.  
  1986.  
  1987.  
  1988.      AAAAPPPPIIII LLLLIIIISSSSTTTTIIIINNNNGGGG
  1989.       This is a listing of functions, macros, flags, and variables
  1990.       that may be useful to    extension writers or that may be found
  1991.       while    reading    other extensions.
  1992.  
  1993.       Note that all    Perl API global    variables must be referenced
  1994.       with the PL_ prefix.    Some macros are    provided for
  1995.       compatibility    with the older,    unadorned names, but this
  1996.       support will be removed in a future release.
  1997.  
  1998.       It is    strongly recommended that all Perl API functions that
  1999.       don't    begin with perl    be referenced with an explicit Perl_
  2000.       prefix.
  2001.  
  2002.       The sort order of the    listing    is case    insensitive, with any
  2003.       occurrences of '_' ignored for the the purpose of sorting.
  2004.  
  2005.       av_clear
  2006.           Clears an array, making it empty.  Does not free the
  2007.           memory used by the array itself.
  2008.  
  2009.               void      av_clear (AV*    ar)
  2010.  
  2011.  
  2012.       av_extend
  2013.           Pre-extend an    array.    The key    is the index to    which
  2014.           the array should be extended.
  2015.  
  2016.               void      av_extend (AV* ar, I32 key)
  2017.  
  2018.  
  2019.       av_fetch
  2020.           Returns the SV at the    specified index    in the array.
  2021.           The key is the index.     If lval is set    then the fetch
  2022.           will be part of a store.  Check that the return
  2023.           value    is non-null before dereferencing it to a SV*.
  2024.  
  2025.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2026.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2027.           this function    on tied    arrays.
  2028.  
  2029.               SV**      av_fetch (AV*    ar, I32    key, I32 lval)
  2030.  
  2031.  
  2032.       AvFILL  Same as av_len().  Deprecated, use av_len() instead.
  2033.  
  2034.       av_len  Returns the highest index in the array.  Returns -1
  2035.           if the array is empty.
  2036.  
  2037.               I32      av_len (AV* ar)
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.      Page 31                        (printed 10/23/98)
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2051.  
  2052.  
  2053.  
  2054.       av_make Creates a new    AV and populates it with a list    of
  2055.           SVs.    The SVs    are copied into    the array, so they may
  2056.           be freed after the call to av_make.  The new AV will
  2057.           have a reference count of 1.
  2058.  
  2059.               AV*      av_make (I32 size, SV** svp)
  2060.  
  2061.  
  2062.       av_pop  Pops an SV off the end of the    array.    Returns
  2063.           &PL_sv_undef if the array is empty.
  2064.  
  2065.               SV*      av_pop (AV* ar)
  2066.  
  2067.  
  2068.       av_push Pushes an SV onto the    end of the array.  The array
  2069.           will grow automatically to accommodate the addition.
  2070.  
  2071.               void      av_push (AV* ar, SV* val)
  2072.  
  2073.  
  2074.       av_shift
  2075.           Shifts an SV off the beginning of the    array.
  2076.  
  2077.               SV*      av_shift (AV*    ar)
  2078.  
  2079.  
  2080.       av_store
  2081.           Stores an SV in an array.  The array index is
  2082.           specified as key.  The return    value will be NULL if
  2083.           the operation    failed or if the value did not need to
  2084.           be actually stored within the    array (as in the case
  2085.           of tied arrays).  Otherwise it can be    dereferenced
  2086.           to get the original SV*.  Note that the caller is
  2087.           responsible for suitably incrementing    the reference
  2088.           count    of val before the call,    and decrementing it if
  2089.           the function returned    NULL.
  2090.  
  2091.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2092.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2093.           this function    on tied    arrays.
  2094.  
  2095.               SV**      av_store (AV*    ar, I32    key, SV* val)
  2096.  
  2097.  
  2098.       av_undef
  2099.           Undefines the    array.    Frees the memory used by the
  2100.           array    itself.
  2101.  
  2102.               void      av_undef (AV*    ar)
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.      Page 32                        (printed 10/23/98)
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2117.  
  2118.  
  2119.  
  2120.       av_unshift
  2121.           Unshift the given number of undef values onto    the
  2122.           beginning of the array.  The array will grow
  2123.           automatically    to accommodate the addition.  You must
  2124.           then use av_store to assign values to    these new
  2125.           elements.
  2126.  
  2127.               void      av_unshift (AV* ar, I32 num)
  2128.  
  2129.  
  2130.       CLASS      Variable which is setup by xsubpp to indicate    the
  2131.           class    name for a C++ XS constructor.    This is    always
  2132.           a char*.  See    THIS and the section on    _U_s_i_n_g _X_S _W_i_t_h
  2133.           _C++ in the _p_e_r_l_x_s manpage.
  2134.  
  2135.       Copy      The XSUB-writer's interface to the C memcpy
  2136.           function.  The s is the source, d is the
  2137.           destination, n is the    number of items, and t is the
  2138.           type.     May fail on overlapping copies.  See also
  2139.           Move.
  2140.  
  2141.               void      Copy(    s, d, n, t )
  2142.  
  2143.  
  2144.       croak      This is the XSUB-writer's interface to Perl's    die
  2145.           function.  Use this function the same    way you    use
  2146.           the C    printf function.  See warn.
  2147.  
  2148.       CvSTASH Returns the stash of the CV.
  2149.  
  2150.               HV*      CvSTASH( SV* sv )
  2151.  
  2152.  
  2153.       PL_DBsingle
  2154.           When Perl is run in debugging    mode, with the ----dddd
  2155.           switch, this SV is a boolean which indicates whether
  2156.           subs are being single-stepped.  Single-stepping is
  2157.           automatically    turned on after    every step.  This is
  2158.           the C    variable which corresponds to Perl's
  2159.           $DB::single variable.     See PL_DBsub.
  2160.  
  2161.       PL_DBsub
  2162.           When Perl is run in debugging    mode, with the ----dddd
  2163.           switch, this GV contains the SV which    holds the name
  2164.           of the sub being debugged.  This is the C variable
  2165.           which    corresponds to Perl's $DB::sub variable.  See
  2166.           PL_DBsingle.    The sub    name can be found by
  2167.  
  2168.               SvPV(    GvSV( PL_DBsub ), PL_na    )
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.      Page 33                        (printed 10/23/98)
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2183.  
  2184.  
  2185.  
  2186.       PL_DBtrace
  2187.           Trace    variable used when Perl    is run in debugging
  2188.           mode,    with the ----dddd switch.  This is the C variable
  2189.           which    corresponds to Perl's $DB::trace variable.
  2190.           See PL_DBsingle.
  2191.  
  2192.       dMARK      Declare a stack marker variable, mark, for the XSUB.
  2193.           See MARK and dORIGMARK.
  2194.  
  2195.       dORIGMARK
  2196.           Saves    the original stack mark    for the    XSUB.  See
  2197.           ORIGMARK.
  2198.  
  2199.       PL_dowarn
  2200.           The C    variable which corresponds to Perl's $^W
  2201.           warning variable.
  2202.  
  2203.       dSP      Declares a local copy    of perl's stack    pointer    for
  2204.           the XSUB, available via the SP macro.     See SP.
  2205.  
  2206.       dXSARGS Sets up stack    and mark pointers for an XSUB, calling
  2207.           dSP and dMARK.  This is usually handled
  2208.           automatically    by xsubpp.  Declares the items
  2209.           variable to indicate the number of items on the
  2210.           stack.
  2211.  
  2212.       dXSI32  Sets up the ix variable for an XSUB which has
  2213.           aliases.  This is usually handled automatically by
  2214.           xsubpp.
  2215.  
  2216.       do_binmode
  2217.           Switches filehandle to binmode.  iotype is what
  2218.           IoTYPE(io) would contain.
  2219.  
  2220.               do_binmode(fp, iotype, TRUE);
  2221.  
  2222.  
  2223.       ENTER      Opening bracket on a callback.  See LEAVE and    the
  2224.           _p_e_r_l_c_a_l_l manpage.
  2225.  
  2226.               ENTER;
  2227.  
  2228.  
  2229.       EXTEND  Used to extend the argument stack for    an XSUB's
  2230.           return values.
  2231.  
  2232.               EXTEND( sp, int x )
  2233.  
  2234.  
  2235.       fbm_compile
  2236.           Analyses the string in order to make fast searches
  2237.           on it    using _f_b_m__i_n_s_t_r() -- the Boyer-Moore
  2238.  
  2239.  
  2240.  
  2241.      Page 34                        (printed 10/23/98)
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2249.  
  2250.  
  2251.  
  2252.           algorithm.
  2253.  
  2254.               void      fbm_compile(SV* sv, U32 flags)
  2255.  
  2256.  
  2257.       fbm_instr
  2258.           Returns the location of the SV in the    string
  2259.           delimited by str and strend.    It returns Nullch if
  2260.           the string can't be found.  The sv does not have to
  2261.           be fbm_compiled, but the search will not be as fast
  2262.           then.
  2263.  
  2264.               char*      fbm_instr(char *str, char *strend, SV    *sv, U32 flags)
  2265.  
  2266.  
  2267.       FREETMPS
  2268.           Closing bracket for temporaries on a callback.  See
  2269.           SAVETMPS and the _p_e_r_l_c_a_l_l manpage.
  2270.  
  2271.               FREETMPS;
  2272.  
  2273.  
  2274.       G_ARRAY Used to indicate array context.  See GIMME_V,    GIMME
  2275.           and the _p_e_r_l_c_a_l_l manpage.
  2276.  
  2277.       G_DISCARD
  2278.           Indicates that arguments returned from a callback
  2279.           should be discarded.    See the    _p_e_r_l_c_a_l_l manpage.
  2280.  
  2281.       G_EVAL  Used to force    a Perl eval wrapper around a callback.
  2282.           See the _p_e_r_l_c_a_l_l manpage.
  2283.  
  2284.       GIMME      A backward-compatible    version    of GIMME_V which can
  2285.           only return G_SCALAR or G_ARRAY; in a    void context,
  2286.           it returns G_SCALAR.
  2287.  
  2288.       GIMME_V The XSUB-writer's equivalent to Perl's wantarray.
  2289.           Returns G_VOID, G_SCALAR or G_ARRAY for void,    scalar
  2290.           or array context, respectively.
  2291.  
  2292.       G_NOARGS
  2293.           Indicates that no arguments are being    sent to    a
  2294.           callback.  See the _p_e_r_l_c_a_l_l manpage.
  2295.  
  2296.       G_SCALAR
  2297.           Used to indicate scalar context.  See    GIMME_V,
  2298.           GIMME, and the _p_e_r_l_c_a_l_l manpage.
  2299.  
  2300.       gv_fetchmeth
  2301.           Returns the glob with    the given name and a defined
  2302.           subroutine or    NULL.  The glob    lives in the given
  2303.           stash, or in the stashes accessible via @ISA and
  2304.  
  2305.  
  2306.  
  2307.      Page 35                        (printed 10/23/98)
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2315.  
  2316.  
  2317.  
  2318.           @UNIVERSAL.
  2319.  
  2320.           The argument level should be either 0    or -1.    If
  2321.           level==0, as a side-effect creates a glob with the
  2322.           given    name in    the given stash    which in the case of
  2323.           success contains an alias for    the subroutine,    and
  2324.           sets up caching info for this    glob.  Similarly for
  2325.           all the searched stashes.
  2326.  
  2327.           This function    grants "SUPER" token as    a postfix of
  2328.           the stash name.
  2329.  
  2330.           The GV returned from gv_fetchmeth may    be a method
  2331.           cache    entry, which is    not visible to Perl code.  So
  2332.           when calling perl_call_sv, you should    not use    the GV
  2333.           directly; instead, you should    use the    method's CV,
  2334.           which    can be obtained    from the GV with the GvCV
  2335.           macro.
  2336.  
  2337.               GV*      gv_fetchmeth (HV* stash, char* name, STRLEN len, I32 level)
  2338.  
  2339.  
  2340.       gv_fetchmethod
  2341.  
  2342.       gv_fetchmethod_autoload
  2343.           Returns the glob which contains the subroutine to
  2344.           call to invoke the method on the stash.  In fact in
  2345.           the presense of autoloading this may be the glob for
  2346.           "AUTOLOAD".  In this case the    corresponding variable
  2347.           $AUTOLOAD is already setup.
  2348.  
  2349.           The third parameter of gv_fetchmethod_autoload
  2350.           determines whether AUTOLOAD lookup is    performed if
  2351.           the given method is not present: non-zero means yes,
  2352.           look for AUTOLOAD; zero means    no, don't look for
  2353.           AUTOLOAD.  Calling gv_fetchmethod is equivalent to
  2354.           calling gv_fetchmethod_autoload with a non-zero
  2355.           autoload parameter.
  2356.  
  2357.           These    functions grant    "SUPER"    token as a prefix of
  2358.           the method name.
  2359.  
  2360.           Note that if you want    to keep    the returned glob for
  2361.           a long time, you need    to check for it    being
  2362.           "AUTOLOAD", since at the later time the call may
  2363.           load a different subroutine due to $AUTOLOAD
  2364.           changing its value.  Use the glob created via    a side
  2365.           effect to do this.
  2366.  
  2367.           These    functions have the same    side-effects and as
  2368.           gv_fetchmeth with level==0.  name should be writable
  2369.           if contains ':' or '\''.  The    warning    against
  2370.  
  2371.  
  2372.  
  2373.      Page 36                        (printed 10/23/98)
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2381.  
  2382.  
  2383.  
  2384.           passing the GV returned by gv_fetchmeth to
  2385.           perl_call_sv apply equally to    these functions.
  2386.  
  2387.               GV*      gv_fetchmethod (HV* stash, char* name)
  2388.               GV*      gv_fetchmethod_autoload (HV* stash, char* name, I32 autoload)
  2389.  
  2390.  
  2391.       G_VOID  Used to indicate void    context.  See GIMME_V and the
  2392.           _p_e_r_l_c_a_l_l manpage.
  2393.  
  2394.       gv_stashpv
  2395.           Returns a pointer to the stash for a specified
  2396.           package.  If create is set then the package will be
  2397.           created if it    does not already exist.     If create is
  2398.           not set and the package does not exist then NULL is
  2399.           returned.
  2400.  
  2401.               HV*      gv_stashpv (char* name, I32 create)
  2402.  
  2403.  
  2404.       gv_stashsv
  2405.           Returns a pointer to the stash for a specified
  2406.           package.  See    gv_stashpv.
  2407.  
  2408.               HV*      gv_stashsv (SV* sv, I32 create)
  2409.  
  2410.  
  2411.       GvSV      Return the SV    from the GV.
  2412.  
  2413.       HEf_SVKEY
  2414.           This flag, used in the length    slot of    hash entries
  2415.           and magic structures,    specifies the structure
  2416.           contains a SV* pointer where a char* pointer is to
  2417.           be expected. (For information    only--not to be    used).
  2418.  
  2419.       HeHASH  Returns the computed hash stored in the hash entry.
  2420.  
  2421.               U32      HeHASH(HE* he)
  2422.  
  2423.  
  2424.       HeKEY      Returns the actual pointer stored in the key slot of
  2425.           the hash entry.  The pointer may be either char* or
  2426.           SV*, depending on the    value of HeKLEN().  Can    be
  2427.           assigned to.    The HePV() or HeSVKEY()    macros are
  2428.           usually preferable for finding the value of a    key.
  2429.  
  2430.               char*      HeKEY(HE* he)
  2431.  
  2432.  
  2433.       HeKLEN  If this is negative, and amounts to HEf_SVKEY, it
  2434.           indicates the    entry holds an SV* key.     Otherwise,
  2435.           holds    the actual length of the key.  Can be assigned
  2436.  
  2437.  
  2438.  
  2439.      Page 37                        (printed 10/23/98)
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2447.  
  2448.  
  2449.  
  2450.           to. The HePV() macro is usually preferable for
  2451.           finding key lengths.
  2452.  
  2453.               int      HeKLEN(HE* he)
  2454.  
  2455.  
  2456.       HePV      Returns the key slot of the hash entry as a char*
  2457.           value, doing any necessary dereferencing of possibly
  2458.           SV* keys.  The length    of the string is placed    in len
  2459.           (this    is a macro, so do _n_o_t use &len).  If you do
  2460.           not care about what the length of the    key is,    you
  2461.           may use the global variable PL_na.  Remember though,
  2462.           that hash keys in perl are free to contain embedded
  2463.           nulls, so using strlen() or similar is not a good
  2464.           way to find the length of hash keys.    This is    very
  2465.           similar to the SvPV()    macro described    elsewhere in
  2466.           this document.
  2467.  
  2468.               char*      HePV(HE* he, STRLEN len)
  2469.  
  2470.  
  2471.       HeSVKEY Returns the key as an    SV*, or    Nullsv if the hash
  2472.           entry    does not contain an SV*    key.
  2473.  
  2474.               HeSVKEY(HE* he)
  2475.  
  2476.  
  2477.       HeSVKEY_force
  2478.           Returns the key as an    SV*.  Will create and return a
  2479.           temporary mortal SV* if the hash entry contains only
  2480.           a char* key.
  2481.  
  2482.               HeSVKEY_force(HE* he)
  2483.  
  2484.  
  2485.       HeSVKEY_set
  2486.           Sets the key to a given SV*, taking care to set the
  2487.           appropriate flags to indicate    the presence of    an SV*
  2488.           key, and returns the same SV*.
  2489.  
  2490.               HeSVKEY_set(HE* he, SV* sv)
  2491.  
  2492.  
  2493.       HeVAL      Returns the value slot (type SV*) stored in the hash
  2494.           entry.
  2495.  
  2496.               HeVAL(HE* he)
  2497.  
  2498.  
  2499.       hv_clear
  2500.           Clears a hash, making    it empty.
  2501.  
  2502.  
  2503.  
  2504.  
  2505.      Page 38                        (printed 10/23/98)
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2513.  
  2514.  
  2515.  
  2516.               void      hv_clear (HV*    tb)
  2517.  
  2518.  
  2519.       hv_delayfree_ent
  2520.           Releases a hash entry, such as while iterating
  2521.           though the hash, but delays actual freeing of    key
  2522.           and value until the end of the current statement (or
  2523.           thereabouts) with sv_2mortal.     See hv_iternext and
  2524.           hv_free_ent.
  2525.  
  2526.               void      hv_delayfree_ent (HV*    hv, HE*    entry)
  2527.  
  2528.  
  2529.       hv_delete
  2530.           Deletes a key/value pair in the hash.     The value SV
  2531.           is removed from the hash and returned    to the caller.
  2532.           The klen is the length of the    key.  The flags    value
  2533.           will normally    be zero; if set    to G_DISCARD then NULL
  2534.           will be returned.
  2535.  
  2536.               SV*      hv_delete (HV* tb, char* key,    U32 klen, I32 flags)
  2537.  
  2538.  
  2539.       hv_delete_ent
  2540.           Deletes a key/value pair in the hash.     The value SV
  2541.           is removed from the hash and returned    to the caller.
  2542.           The flags value will normally    be zero; if set    to
  2543.           G_DISCARD then NULL will be returned.     hash can be a
  2544.           valid    precomputed hash value,    or 0 to    ask for    it to
  2545.           be computed.
  2546.  
  2547.               SV*      hv_delete_ent    (HV* tb, SV* key, I32 flags, U32 hash)
  2548.  
  2549.  
  2550.       hv_exists
  2551.           Returns a boolean indicating whether the specified
  2552.           hash key exists.  The    klen is    the length of the key.
  2553.  
  2554.               bool      hv_exists (HV* tb, char* key,    U32 klen)
  2555.  
  2556.  
  2557.       hv_exists_ent
  2558.           Returns a boolean indicating whether the specified
  2559.           hash key exists. hash    can be a valid precomputed
  2560.           hash value, or 0 to ask for it to be computed.
  2561.  
  2562.               bool      hv_exists_ent    (HV* tb, SV* key, U32 hash)
  2563.  
  2564.  
  2565.       hv_fetch
  2566.           Returns the SV which corresponds to the specified
  2567.           key in the hash.  The    klen is    the length of the key.
  2568.  
  2569.  
  2570.  
  2571.      Page 39                        (printed 10/23/98)
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2579.  
  2580.  
  2581.  
  2582.           If lval is set then the fetch    will be    part of    a
  2583.           store.  Check    that the return    value is non-null
  2584.           before dereferencing it to a SV*.
  2585.  
  2586.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2587.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2588.           this function    on tied    hashes.
  2589.  
  2590.               SV**      hv_fetch (HV*    tb, char* key, U32 klen, I32 lval)
  2591.  
  2592.  
  2593.       hv_fetch_ent
  2594.           Returns the hash entry which corresponds to the
  2595.           specified key    in the hash.  hash must    be a valid
  2596.           precomputed hash number for the given    key, or    0 if
  2597.           you want the function    to compute it.    IF lval    is set
  2598.           then the fetch will be part of a store.  Make    sure
  2599.           the return value is non-null before accessing    it.
  2600.           The return value when    tb is a    tied hash is a pointer
  2601.           to a static location,    so be sure to make a copy of
  2602.           the structure    if you need to store it    somewhere.
  2603.  
  2604.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2605.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2606.           this function    on tied    hashes.
  2607.  
  2608.               HE*      hv_fetch_ent    (HV* tb, SV* key, I32 lval, U32    hash)
  2609.  
  2610.  
  2611.       hv_free_ent
  2612.           Releases a hash entry, such as while iterating
  2613.           though the hash.  See    hv_iternext and
  2614.           hv_delayfree_ent.
  2615.  
  2616.               void      hv_free_ent (HV* hv, HE* entry)
  2617.  
  2618.  
  2619.       hv_iterinit
  2620.           Prepares a starting point to traverse    a hash table.
  2621.  
  2622.               I32      hv_iterinit (HV* tb)
  2623.  
  2624.           Returns the number of    keys in    the hash (i.e. the
  2625.           same as HvKEYS(tb)).    The return value is currently
  2626.           only meaningful for hashes without tie magic.
  2627.  
  2628.           NOTE:    Before version 5.004_65, hv_iterinit used to
  2629.           return the number of hash buckets that happen    to be
  2630.           in use.  If you still    need that esoteric value, you
  2631.           can get it through the macro HvFILL(tb).
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.      Page 40                        (printed 10/23/98)
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2645.  
  2646.  
  2647.  
  2648.       hv_iterkey
  2649.           Returns the key from the current position of the
  2650.           hash iterator.  See hv_iterinit.
  2651.  
  2652.               char*      hv_iterkey (HE* entry, I32* retlen)
  2653.  
  2654.  
  2655.       hv_iterkeysv
  2656.           Returns the key as an    SV* from the current position
  2657.           of the hash iterator.     The return value will always
  2658.           be a mortal copy of the key.    Also see hv_iterinit.
  2659.  
  2660.               SV*      hv_iterkeysv    (HE* entry)
  2661.  
  2662.  
  2663.       hv_iternext
  2664.           Returns entries from a hash iterator.     See
  2665.           hv_iterinit.
  2666.  
  2667.               HE*      hv_iternext (HV* tb)
  2668.  
  2669.  
  2670.       hv_iternextsv
  2671.           Performs an hv_iternext, hv_iterkey, and hv_iterval
  2672.           in one operation.
  2673.  
  2674.               SV*      hv_iternextsv    (HV* hv, char**    key, I32* retlen)
  2675.  
  2676.  
  2677.       hv_iterval
  2678.           Returns the value from the current position of the
  2679.           hash iterator.  See hv_iterkey.
  2680.  
  2681.               SV*      hv_iterval (HV* tb, HE* entry)
  2682.  
  2683.  
  2684.       hv_magic
  2685.           Adds magic to    a hash.     See sv_magic.
  2686.  
  2687.               void      hv_magic (HV*    hv, GV*    gv, int    how)
  2688.  
  2689.  
  2690.       HvNAME  Returns the package name of a    stash.    See SvSTASH,
  2691.           CvSTASH.
  2692.  
  2693.               char*      HvNAME (HV* stash)
  2694.  
  2695.  
  2696.       hv_store
  2697.           Stores an SV in a hash.  The hash key    is specified
  2698.           as key and klen is the length    of the key.  The hash
  2699.           parameter is the precomputed hash value; if it is
  2700.  
  2701.  
  2702.  
  2703.      Page 41                        (printed 10/23/98)
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2711.  
  2712.  
  2713.  
  2714.           zero then Perl will compute it.  The return value
  2715.           will be NULL if the operation    failed or if the value
  2716.           did not need to be actually stored within the    hash
  2717.           (as in the case of tied hashes).  Otherwise it can
  2718.           be dereferenced to get the original SV*.  Note that
  2719.           the caller is    responsible for    suitably incrementing
  2720.           the reference    count of val before the    call, and
  2721.           decrementing it if the function returned NULL.
  2722.  
  2723.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2724.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2725.           this function    on tied    hashes.
  2726.  
  2727.               SV**      hv_store (HV*    tb, char* key, U32 klen, SV* val, U32 hash)
  2728.  
  2729.  
  2730.       hv_store_ent
  2731.           Stores val in    a hash.     The hash key is specified as
  2732.           key.    The hash parameter is the precomputed hash
  2733.           value; if it is zero then Perl will compute it.  The
  2734.           return value is the new hash entry so    created.  It
  2735.           will be NULL if the operation    failed or if the value
  2736.           did not need to be actually stored within the    hash
  2737.           (as in the case of tied hashes).  Otherwise the
  2738.           contents of the return value can be accessed using
  2739.           the He??? macros described here.  Note that the
  2740.           caller is responsible    for suitably incrementing the
  2741.           reference count of val before    the call, and
  2742.           decrementing it if the function returned NULL.
  2743.  
  2744.           See the section on _U_n_d_e_r_s_t_a_n_d_i_n_g _t_h_e _M_a_g_i_c _o_f    _T_i_e_d
  2745.           _H_a_s_h_e_s _a_n_d _A_r_r_a_y_s for    more information on how    to use
  2746.           this function    on tied    hashes.
  2747.  
  2748.               HE*      hv_store_ent    (HV* tb, SV* key, SV* val, U32 hash)
  2749.  
  2750.  
  2751.       hv_undef
  2752.           Undefines the    hash.
  2753.  
  2754.               void      hv_undef (HV*    tb)
  2755.  
  2756.  
  2757.       isALNUM Returns a boolean indicating whether the C char is
  2758.           an ascii alphanumeric    character or digit.
  2759.  
  2760.               int      isALNUM (char    c)
  2761.  
  2762.  
  2763.       isALPHA Returns a boolean indicating whether the C char is
  2764.           an ascii alphabetic character.
  2765.  
  2766.  
  2767.  
  2768.  
  2769.      Page 42                        (printed 10/23/98)
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2777.  
  2778.  
  2779.  
  2780.               int      isALPHA (char    c)
  2781.  
  2782.  
  2783.       isDIGIT Returns a boolean indicating whether the C char is
  2784.           an ascii digit.
  2785.  
  2786.               int      isDIGIT (char    c)
  2787.  
  2788.  
  2789.       isLOWER Returns a boolean indicating whether the C char is a
  2790.           lowercase character.
  2791.  
  2792.               int      isLOWER (char    c)
  2793.  
  2794.  
  2795.       isSPACE Returns a boolean indicating whether the C char is
  2796.           whitespace.
  2797.  
  2798.               int      isSPACE (char    c)
  2799.  
  2800.  
  2801.       isUPPER Returns a boolean indicating whether the C char is
  2802.           an uppercase character.
  2803.  
  2804.               int      isUPPER (char    c)
  2805.  
  2806.  
  2807.       items      Variable which is setup by xsubpp to indicate    the
  2808.           number of items on the stack.     See the section on
  2809.           _V_a_r_i_a_b_l_e-_l_e_n_g_t_h _P_a_r_a_m_e_t_e_r _L_i_s_t_s in the _p_e_r_l_x_s
  2810.           manpage.
  2811.  
  2812.       ix      Variable which is setup by xsubpp to indicate    which
  2813.           of an    XSUB's aliases was used    to invoke it.  See the
  2814.           section on _T_h_e _A_L_I_A_S:    _K_e_y_w_o_r_d    in the _p_e_r_l_x_s manpage.
  2815.  
  2816.       LEAVE      Closing bracket on a callback.  See ENTER and    the
  2817.           _p_e_r_l_c_a_l_l manpage.
  2818.  
  2819.               LEAVE;
  2820.  
  2821.  
  2822.       looks_like_number
  2823.           Test if an the content of an SV looks    like a number
  2824.           (or is a number).
  2825.  
  2826.               int      looks_like_number(SV*)
  2827.  
  2828.  
  2829.       MARK      Stack    marker variable    for the    XSUB.  See dMARK.
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.      Page 43                        (printed 10/23/98)
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2843.  
  2844.  
  2845.  
  2846.       mg_clear
  2847.           Clear    something magical that the SV represents.  See
  2848.           sv_magic.
  2849.  
  2850.               int      mg_clear (SV*    sv)
  2851.  
  2852.  
  2853.       mg_copy Copies the magic from    one SV to another.  See
  2854.           sv_magic.
  2855.  
  2856.               int      mg_copy (SV *, SV *, char *, STRLEN)
  2857.  
  2858.  
  2859.       mg_find Finds    the magic pointer for type matching the    SV.
  2860.           See sv_magic.
  2861.  
  2862.               MAGIC*  mg_find (SV* sv, int type)
  2863.  
  2864.  
  2865.       mg_free Free any magic storage used by the SV.  See
  2866.           sv_magic.
  2867.  
  2868.               int      mg_free (SV* sv)
  2869.  
  2870.  
  2871.       mg_get  Do magic after a value is retrieved from the SV.
  2872.           See sv_magic.
  2873.  
  2874.               int      mg_get (SV* sv)
  2875.  
  2876.  
  2877.       mg_len  Report on the    SV's length.  See sv_magic.
  2878.  
  2879.               U32      mg_len (SV* sv)
  2880.  
  2881.  
  2882.       mg_magical
  2883.           Turns    on the magical status of an SV.     See sv_magic.
  2884.  
  2885.               void      mg_magical (SV* sv)
  2886.  
  2887.  
  2888.       mg_set  Do magic after a value is assigned to    the SV.     See
  2889.           sv_magic.
  2890.  
  2891.               int      mg_set (SV* sv)
  2892.  
  2893.  
  2894.       Move      The XSUB-writer's interface to the C memmove
  2895.           function.  The s is the source, d is the
  2896.           destination, n is the    number of items, and t is the
  2897.           type.     Can do    overlapping moves.  See    also Copy.
  2898.  
  2899.  
  2900.  
  2901.      Page 44                        (printed 10/23/98)
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2909.  
  2910.  
  2911.  
  2912.               void      Move(    s, d, n, t )
  2913.  
  2914.  
  2915.       PL_na      A variable which may be used with SvPV to tell Perl
  2916.           to calculate the string length.
  2917.  
  2918.       New      The XSUB-writer's interface to the C malloc
  2919.           function.
  2920.  
  2921.               void*      New( x, void *ptr, int size, type )
  2922.  
  2923.  
  2924.       newAV      Creates a new    AV.  The reference count is set    to 1.
  2925.  
  2926.               AV*      newAV    (void)
  2927.  
  2928.  
  2929.       Newc      The XSUB-writer's interface to the C malloc
  2930.           function, with cast.
  2931.  
  2932.               void*      Newc(    x, void    *ptr, int size,    type, cast )
  2933.  
  2934.  
  2935.       newCONSTSUB
  2936.           Creates a constant sub equivalent to Perl sub    FOO ()
  2937.           { 123    } which    is eligible for    inlining at compile-
  2938.           time.
  2939.  
  2940.               void      newCONSTSUB(HV* stash, char* name, SV* sv)
  2941.  
  2942.  
  2943.       newHV      Creates a new    HV.  The reference count is set    to 1.
  2944.  
  2945.               HV*      newHV    (void)
  2946.  
  2947.  
  2948.       newRV_inc
  2949.           Creates an RV    wrapper    for an SV.  The    reference
  2950.           count    for the    original SV is incremented.
  2951.  
  2952.               SV*      newRV_inc (SV* ref)
  2953.  
  2954.           For historical reasons, "newRV" is a synonym for
  2955.           "newRV_inc".
  2956.  
  2957.       newRV_noinc
  2958.           Creates an RV    wrapper    for an SV.  The    reference
  2959.           count    for the    original SV is nnnnooootttt incremented.
  2960.  
  2961.               SV*      newRV_noinc (SV* ref)
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.      Page 45                        (printed 10/23/98)
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  2975.  
  2976.  
  2977.  
  2978.       NEWSV      Creates a new    SV.  A non-zero    len parameter
  2979.           indicates the    number of bytes    of preallocated    string
  2980.           space    the SV should have.  An    extra byte for a
  2981.           tailing NUL is also reserved.     (SvPOK    is not set for
  2982.           the SV even if string    space is allocated.)  The
  2983.           reference count for the new SV is set    to 1.  id is
  2984.           an integer id    between    0 and 1299 (used to identify
  2985.           leaks).
  2986.  
  2987.               SV*      NEWSV    (int id, STRLEN    len)
  2988.  
  2989.  
  2990.       newSViv Creates a new    SV and copies an integer into it.  The
  2991.           reference count for the SV is    set to 1.
  2992.  
  2993.               SV*      newSViv (IV i)
  2994.  
  2995.  
  2996.       newSVnv Creates a new    SV and copies a    double into it.     The
  2997.           reference count for the SV is    set to 1.
  2998.  
  2999.               SV*      newSVnv (NV i)
  3000.  
  3001.  
  3002.       newSVpv Creates a new    SV and copies a    string into it.     The
  3003.           reference count for the SV is    set to 1.  If len is
  3004.           zero then Perl will compute the length.
  3005.  
  3006.               SV*      newSVpv (char* s, STRLEN len)
  3007.  
  3008.  
  3009.       newSVpvf
  3010.           Creates a new    SV an initialize it with the string
  3011.           formatted like sprintf.
  3012.  
  3013.               SV*      newSVpvf(const char* pat, ...);
  3014.  
  3015.  
  3016.       newSVpvn
  3017.           Creates a new    SV and copies a    string into it.     The
  3018.           reference count for the SV is    set to 1.  If len is
  3019.           zero then Perl will create a zero length string.
  3020.  
  3021.               SV*      newSVpvn (char* s, STRLEN len)
  3022.  
  3023.  
  3024.       newSVrv Creates a new    SV for the RV, rv, to point to.     If rv
  3025.           is not an RV then it will be upgraded    to one.     If
  3026.           classname is non-null    then the new SV    will be
  3027.           blessed in the specified package.  The new SV    is
  3028.           returned and its reference count is 1.
  3029.  
  3030.  
  3031.  
  3032.  
  3033.      Page 46                        (printed 10/23/98)
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3041.  
  3042.  
  3043.  
  3044.               SV*      newSVrv (SV* rv, char* classname)
  3045.  
  3046.  
  3047.       newSVsv Creates a new    SV which is an exact duplicate of the
  3048.           original SV.
  3049.  
  3050.               SV*      newSVsv (SV* old)
  3051.  
  3052.  
  3053.       newXS      Used by xsubpp to hook up XSUBs as Perl subs.
  3054.  
  3055.       newXSproto
  3056.           Used by xsubpp to hook up XSUBs as Perl subs.     Adds
  3057.           Perl prototypes to the subs.
  3058.  
  3059.       Newz      The XSUB-writer's interface to the C malloc
  3060.           function.  The allocated memory is zeroed with
  3061.           memzero.
  3062.  
  3063.               void*      Newz(    x, void    *ptr, int size,    type )
  3064.  
  3065.  
  3066.       Nullav  Null AV pointer.
  3067.  
  3068.       Nullch  Null character pointer.
  3069.  
  3070.       Nullcv  Null CV pointer.
  3071.  
  3072.       Nullhv  Null HV pointer.
  3073.  
  3074.       Nullsv  Null SV pointer.
  3075.  
  3076.       ORIGMARK
  3077.           The original stack mark for the XSUB.     See
  3078.           dORIGMARK.
  3079.  
  3080.       perl_alloc
  3081.           Allocates a new Perl interpreter.  See the _p_e_r_l_e_m_b_e_d
  3082.           manpage.
  3083.  
  3084.       perl_call_argv
  3085.           Performs a callback to the specified Perl sub.  See
  3086.           the _p_e_r_l_c_a_l_l manpage.
  3087.  
  3088.               I32      perl_call_argv (char*    subname, I32 flags, char** argv)
  3089.  
  3090.  
  3091.       perl_call_method
  3092.           Performs a callback to the specified Perl method.
  3093.           The blessed object must be on    the stack.  See    the
  3094.           _p_e_r_l_c_a_l_l manpage.
  3095.  
  3096.  
  3097.  
  3098.  
  3099.      Page 47                        (printed 10/23/98)
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3107.  
  3108.  
  3109.  
  3110.               I32      perl_call_method (char* methname, I32    flags)
  3111.  
  3112.  
  3113.       perl_call_pv
  3114.           Performs a callback to the specified Perl sub.  See
  3115.           the _p_e_r_l_c_a_l_l manpage.
  3116.  
  3117.               I32      perl_call_pv (char* subname, I32 flags)
  3118.  
  3119.  
  3120.       perl_call_sv
  3121.           Performs a callback to the Perl sub whose name is in
  3122.           the SV.  See the _p_e_r_l_c_a_l_l manpage.
  3123.  
  3124.               I32      perl_call_sv (SV* sv,    I32 flags)
  3125.  
  3126.  
  3127.       perl_construct
  3128.           Initializes a    new Perl interpreter.  See the
  3129.           _p_e_r_l_e_m_b_e_d manpage.
  3130.  
  3131.       perl_destruct
  3132.           Shuts    down a Perl interpreter.  See the _p_e_r_l_e_m_b_e_d
  3133.           manpage.
  3134.  
  3135.       perl_eval_sv
  3136.           Tells    Perl to    eval the string    in the SV.
  3137.  
  3138.               I32      perl_eval_sv (SV* sv,    I32 flags)
  3139.  
  3140.  
  3141.       perl_eval_pv
  3142.           Tells    Perl to    eval the given string and return an
  3143.           SV* result.
  3144.  
  3145.               SV*      perl_eval_pv (char* p, I32 croak_on_error)
  3146.  
  3147.  
  3148.       perl_free
  3149.           Releases a Perl interpreter.    See the    _p_e_r_l_e_m_b_e_d
  3150.           manpage.
  3151.  
  3152.       perl_get_av
  3153.           Returns the AV of the    specified Perl array.  If
  3154.           create is set    and the    Perl variable does not exist
  3155.           then it will be created.  If create is not set and
  3156.           the variable does not    exist then NULL    is returned.
  3157.  
  3158.               AV*      perl_get_av (char* name, I32 create)
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.      Page 48                        (printed 10/23/98)
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3173.  
  3174.  
  3175.  
  3176.       perl_get_cv
  3177.           Returns the CV of the    specified Perl sub.  If    create
  3178.           is set and the Perl variable does not    exist then it
  3179.           will be created.  If create is not set and the
  3180.           variable does    not exist then NULL is returned.
  3181.  
  3182.               CV*      perl_get_cv (char* name, I32 create)
  3183.  
  3184.  
  3185.       perl_get_hv
  3186.           Returns the HV of the    specified Perl hash.  If
  3187.           create is set    and the    Perl variable does not exist
  3188.           then it will be created.  If create is not set and
  3189.           the variable does not    exist then NULL    is returned.
  3190.  
  3191.               HV*      perl_get_hv (char* name, I32 create)
  3192.  
  3193.  
  3194.       perl_get_sv
  3195.           Returns the SV of the    specified Perl scalar.    If
  3196.           create is set    and the    Perl variable does not exist
  3197.           then it will be created.  If create is not set and
  3198.           the variable does not    exist then NULL    is returned.
  3199.  
  3200.               SV*      perl_get_sv (char* name, I32 create)
  3201.  
  3202.  
  3203.       perl_parse
  3204.           Tells    a Perl interpreter to parse a Perl script.
  3205.           See the _p_e_r_l_e_m_b_e_d manpage.
  3206.  
  3207.       perl_require_pv
  3208.           Tells    Perl to    require    a module.
  3209.  
  3210.               void      perl_require_pv (char* pv)
  3211.  
  3212.  
  3213.       perl_run
  3214.           Tells    a Perl interpreter to run.  See    the _p_e_r_l_e_m_b_e_d
  3215.           manpage.
  3216.  
  3217.       POPi      Pops an integer off the stack.
  3218.  
  3219.               int      POPi()
  3220.  
  3221.  
  3222.       POPl      Pops a long off the stack.
  3223.  
  3224.               long      POPl()
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.      Page 49                        (printed 10/23/98)
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3239.  
  3240.  
  3241.  
  3242.       POPp      Pops a string    off the    stack.
  3243.  
  3244.               char*      POPp()
  3245.  
  3246.  
  3247.       POPn      Pops a double    off the    stack.
  3248.  
  3249.               double  POPn()
  3250.  
  3251.  
  3252.       POPs      Pops an SV off the stack.
  3253.  
  3254.               SV*      POPs()
  3255.  
  3256.  
  3257.       PUSHMARK
  3258.           Opening bracket for arguments    on a callback.    See
  3259.           PUTBACK and the _p_e_r_l_c_a_l_l manpage.
  3260.  
  3261.               PUSHMARK(p)
  3262.  
  3263.  
  3264.       PUSHi      Push an integer onto the stack.  The stack must have
  3265.           room for this    element.  Handles 'set'    magic.    See
  3266.           XPUSHi.
  3267.  
  3268.               void      PUSHi(int d)
  3269.  
  3270.  
  3271.       PUSHn      Push a double    onto the stack.     The stack must    have
  3272.           room for this    element.  Handles 'set'    magic.    See
  3273.           XPUSHn.
  3274.  
  3275.               void      PUSHn(double d)
  3276.  
  3277.  
  3278.       PUSHp      Push a string    onto the stack.     The stack must    have
  3279.           room for this    element.  The len indicates the    length
  3280.           of the string.  Handles 'set'    magic.    See XPUSHp.
  3281.  
  3282.               void      PUSHp(char *c, int len )
  3283.  
  3284.  
  3285.       PUSHs      Push an SV onto the stack.  The stack    must have room
  3286.           for this element.  Does not handle 'set' magic.  See
  3287.           XPUSHs.
  3288.  
  3289.               void      PUSHs(sv)
  3290.  
  3291.  
  3292.       PUSHu      Push an unsigned integer onto    the stack.  The    stack
  3293.           must have room for this element.  See    XPUSHu.
  3294.  
  3295.  
  3296.  
  3297.      Page 50                        (printed 10/23/98)
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3305.  
  3306.  
  3307.  
  3308.               void      PUSHu(unsigned int d)
  3309.  
  3310.  
  3311.       PUTBACK Closing bracket for XSUB arguments.  This is usually
  3312.           handled by xsubpp.  See PUSHMARK and the _p_e_r_l_c_a_l_l
  3313.           manpage for other uses.
  3314.  
  3315.               PUTBACK;
  3316.  
  3317.  
  3318.       Renew      The XSUB-writer's interface to the C realloc
  3319.           function.
  3320.  
  3321.               void*      Renew( void *ptr, int    size, type )
  3322.  
  3323.  
  3324.       Renewc  The XSUB-writer's interface to the C realloc
  3325.           function, with cast.
  3326.  
  3327.               void*      Renewc( void *ptr, int size, type, cast )
  3328.  
  3329.  
  3330.       RETVAL  Variable which is setup by xsubpp to hold the    return
  3331.           value    for an XSUB.  This is always the proper    type
  3332.           for the XSUB.     See the section on _T_h_e    _R_E_T_V_A_L
  3333.           _V_a_r_i_a_b_l_e in the _p_e_r_l_x_s manpage.
  3334.  
  3335.       safefree
  3336.           The XSUB-writer's interface to the C free function.
  3337.  
  3338.       safemalloc
  3339.           The XSUB-writer's interface to the C malloc
  3340.           function.
  3341.  
  3342.       saferealloc
  3343.           The XSUB-writer's interface to the C realloc
  3344.           function.
  3345.  
  3346.       savepv  Copy a string    to a safe spot.     This does not use an
  3347.           SV.
  3348.  
  3349.               char*      savepv (char*    sv)
  3350.  
  3351.  
  3352.       savepvn Copy a string    to a safe spot.     The len indicates
  3353.           number of bytes to copy.  This does not use an SV.
  3354.  
  3355.               char*      savepvn (char* sv, I32 len)
  3356.  
  3357.  
  3358.       SAVETMPS
  3359.           Opening bracket for temporaries on a callback.  See
  3360.  
  3361.  
  3362.  
  3363.      Page 51                        (printed 10/23/98)
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3371.  
  3372.  
  3373.  
  3374.           FREETMPS and the _p_e_r_l_c_a_l_l manpage.
  3375.  
  3376.               SAVETMPS;
  3377.  
  3378.  
  3379.       SP      Stack    pointer.  This is usually handled by xsubpp.
  3380.           See dSP and SPAGAIN.
  3381.  
  3382.       SPAGAIN Refetch the stack pointer.  Used after a callback.
  3383.           See the _p_e_r_l_c_a_l_l manpage.
  3384.  
  3385.               SPAGAIN;
  3386.  
  3387.  
  3388.       ST      Used to access elements on the XSUB's    stack.
  3389.  
  3390.               SV*      ST(int x)
  3391.  
  3392.  
  3393.       strEQ      Test two strings to see if they are equal.  Returns
  3394.           true or false.
  3395.  
  3396.               int      strEQ( char *s1, char    *s2 )
  3397.  
  3398.  
  3399.       strGE      Test two strings to see if the first,    s1, is greater
  3400.           than or equal    to the second, s2.  Returns true or
  3401.           false.
  3402.  
  3403.               int      strGE( char *s1, char    *s2 )
  3404.  
  3405.  
  3406.       strGT      Test two strings to see if the first,    s1, is greater
  3407.           than the second, s2.    Returns    true or    false.
  3408.  
  3409.               int      strGT( char *s1, char    *s2 )
  3410.  
  3411.  
  3412.       strLE      Test two strings to see if the first,    s1, is less
  3413.           than or equal    to the second, s2.  Returns true or
  3414.           false.
  3415.  
  3416.               int      strLE( char *s1, char    *s2 )
  3417.  
  3418.  
  3419.       strLT      Test two strings to see if the first,    s1, is less
  3420.           than the second, s2.    Returns    true or    false.
  3421.  
  3422.               int      strLT( char *s1, char    *s2 )
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.      Page 52                        (printed 10/23/98)
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3437.  
  3438.  
  3439.  
  3440.       strNE      Test two strings to see if they are different.
  3441.           Returns true or false.
  3442.  
  3443.               int      strNE( char *s1, char    *s2 )
  3444.  
  3445.  
  3446.       strnEQ  Test two strings to see if they are equal.  The len
  3447.           parameter indicates the number of bytes to compare.
  3448.           Returns true or false.
  3449.  
  3450.               int      strnEQ( char *s1, char *s2 )
  3451.  
  3452.  
  3453.       strnNE  Test two strings to see if they are different.  The
  3454.           len parameter    indicates the number of    bytes to
  3455.           compare.  Returns true or false.
  3456.  
  3457.               int      strnNE( char *s1, char *s2, int len )
  3458.  
  3459.  
  3460.       sv_2mortal
  3461.           Marks    an SV as mortal.  The SV will be destroyed
  3462.           when the current context ends.
  3463.  
  3464.               SV*      sv_2mortal (SV* sv)
  3465.  
  3466.  
  3467.       sv_bless
  3468.           Blesses an SV    into a specified package.  The SV must
  3469.           be an    RV.  The package must be designated by its
  3470.           stash    (see gv_stashpv()).  The reference count of
  3471.           the SV is unaffected.
  3472.  
  3473.               SV*      sv_bless (SV*    sv, HV*    stash)
  3474.  
  3475.  
  3476.       sv_catpv
  3477.           Concatenates the string onto the end of the string
  3478.           which    is in the SV.  Handles 'get' magic, but    not
  3479.           'set'    magic.    See sv_catpv_mg.
  3480.  
  3481.               void      sv_catpv (SV*    sv, char* ptr)
  3482.  
  3483.  
  3484.       sv_catpv_mg
  3485.           Like sv_catpv, but also handles 'set'    magic.
  3486.  
  3487.               void      sv_catpvn (SV* sv, char* ptr)
  3488.  
  3489.  
  3490.       sv_catpvn
  3491.           Concatenates the string onto the end of the string
  3492.  
  3493.  
  3494.  
  3495.      Page 53                        (printed 10/23/98)
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3503.  
  3504.  
  3505.  
  3506.           which    is in the SV.  The len indicates number    of
  3507.           bytes    to copy.  Handles 'get'    magic, but not 'set'
  3508.           magic.  See sv_catpvn_mg.
  3509.  
  3510.               void      sv_catpvn (SV* sv, char* ptr,    STRLEN len)
  3511.  
  3512.  
  3513.       sv_catpvn_mg
  3514.           Like sv_catpvn, but also handles 'set' magic.
  3515.  
  3516.               void      sv_catpvn_mg (SV* sv,    char* ptr, STRLEN len)
  3517.  
  3518.  
  3519.       sv_catpvf
  3520.           Processes its    arguments like sprintf and appends the
  3521.           formatted output to an SV.  Handles 'get' magic, but
  3522.           not 'set' magic.  SvSETMAGIC() must typically    be
  3523.           called after calling this function to    handle 'set'
  3524.           magic.
  3525.  
  3526.               void      sv_catpvf (SV* sv, const char* pat, ...)
  3527.  
  3528.  
  3529.       sv_catpvf_mg
  3530.           Like sv_catpvf, but also handles 'set' magic.
  3531.  
  3532.               void      sv_catpvf_mg (SV* sv,    const char* pat, ...)
  3533.  
  3534.  
  3535.       sv_catsv
  3536.           Concatenates the string from SV ssv onto the end of
  3537.           the string in    SV dsv.     Handles 'get' magic, but not
  3538.           'set'    magic.    See sv_catsv_mg.
  3539.  
  3540.               void      sv_catsv (SV*    dsv, SV* ssv)
  3541.  
  3542.  
  3543.       sv_catsv_mg
  3544.           Like sv_catsv, but also handles 'set'    magic.
  3545.  
  3546.               void      sv_catsv_mg (SV* dsv,    SV* ssv)
  3547.  
  3548.  
  3549.       sv_chop Efficient removal of characters from the beginning
  3550.           of the string    buffer.     _S_v_P_O_K(sv) must    be true    and
  3551.           the ptr must be a pointer to somewhere inside    the
  3552.           string buffer.  The ptr becomes the first character
  3553.           of the adjusted string.
  3554.  
  3555.               void      sv_chop(SV* sv, char *ptr)
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.      Page 54                        (printed 10/23/98)
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3569.  
  3570.  
  3571.  
  3572.       sv_cmp  Compares the strings in two SVs.  Returns -1,    0, or
  3573.           1 indicating whether the string in sv1 is less than,
  3574.           equal    to, or greater than the    string in sv2.
  3575.  
  3576.               I32      sv_cmp (SV* sv1, SV* sv2)
  3577.  
  3578.  
  3579.       SvCUR      Returns the length of    the string which is in the SV.
  3580.           See SvLEN.
  3581.  
  3582.               int      SvCUR    (SV* sv)
  3583.  
  3584.  
  3585.       SvCUR_set
  3586.           Set the length of the    string which is    in the SV.
  3587.           See SvCUR.
  3588.  
  3589.               void      SvCUR_set (SV* sv, int val )
  3590.  
  3591.  
  3592.       sv_dec  Auto-decrement of the    value in the SV.
  3593.  
  3594.               void      sv_dec (SV* sv)
  3595.  
  3596.  
  3597.       sv_derived_from
  3598.           Returns a boolean indicating whether the SV is a
  3599.           subclass of the specified class.
  3600.  
  3601.               int      sv_derived_from(SV* sv, char*    class)
  3602.  
  3603.  
  3604.       sv_derived_from
  3605.           Returns a boolean indicating whether the SV is
  3606.           derived from the specified class.  This is the
  3607.           function that    implements UNIVERSAL::isa.  It works
  3608.           for class names as well as for objects.
  3609.  
  3610.               bool      sv_derived_from _((SV* sv, char* name));
  3611.  
  3612.  
  3613.       SvEND      Returns a pointer to the last    character in the
  3614.           string which is in the SV.  See SvCUR.  Access the
  3615.           character as
  3616.  
  3617.               char*      SvEND(sv)
  3618.  
  3619.  
  3620.       sv_eq      Returns a boolean indicating whether the strings in
  3621.           the two SVs are identical.
  3622.  
  3623.               I32      sv_eq    (SV* sv1, SV* sv2)
  3624.  
  3625.  
  3626.  
  3627.      Page 55                        (printed 10/23/98)
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3635.  
  3636.  
  3637.  
  3638.       SvGETMAGIC
  3639.           Invokes mg_get on an SV if it    has 'get' magic.  This
  3640.           macro    evaluates its argument more than once.
  3641.  
  3642.               void      SvGETMAGIC( SV *sv )
  3643.  
  3644.  
  3645.       SvGROW  Expands the character    buffer in the SV so that it
  3646.           has room for the indicated number of bytes (remember
  3647.           to reserve space for an extra    trailing NUL
  3648.           character).  Calls sv_grow to    perform    the expansion
  3649.           if necessary.     Returns a pointer to the character
  3650.           buffer.
  3651.  
  3652.               char*      SvGROW( SV* sv, int len )
  3653.  
  3654.  
  3655.       sv_grow Expands the character    buffer in the SV.  This    will
  3656.           use sv_unref and will    upgrade    the SV to SVt_PV.
  3657.           Returns a pointer to the character buffer.  Use
  3658.           SvGROW.
  3659.  
  3660.       sv_inc  Auto-increment of the    value in the SV.
  3661.  
  3662.               void      sv_inc (SV* sv)
  3663.  
  3664.  
  3665.       sv_insert
  3666.           Inserts a string at the specified offset/length
  3667.           within the SV.  Similar to the Perl _s_u_b_s_t_r()
  3668.           function.
  3669.  
  3670.               void      sv_insert(SV *sv, STRLEN offset, STRLEN len,
  3671.                         char *str, STRLEN strlen)
  3672.  
  3673.  
  3674.       SvIOK      Returns a boolean indicating whether the SV contains
  3675.           an integer.
  3676.  
  3677.               int      SvIOK    (SV* SV)
  3678.  
  3679.  
  3680.       SvIOK_off
  3681.           Unsets the IV    status of an SV.
  3682.  
  3683.               void      SvIOK_off (SV* sv)
  3684.  
  3685.  
  3686.       SvIOK_on
  3687.           Tells    an SV that it is an integer.
  3688.  
  3689.               void      SvIOK_on (SV*    sv)
  3690.  
  3691.  
  3692.  
  3693.      Page 56                        (printed 10/23/98)
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3701.  
  3702.  
  3703.  
  3704.       SvIOK_only
  3705.           Tells    an SV that it is an integer and    disables all
  3706.           other    OK bits.
  3707.  
  3708.               void      SvIOK_only (SV* sv)
  3709.  
  3710.  
  3711.       SvIOKp  Returns a boolean indicating whether the SV contains
  3712.           an integer.  Checks the pppprrrriiiivvvvaaaatttteeee setting.  Use    SvIOK.
  3713.  
  3714.               int      SvIOKp (SV* SV)
  3715.  
  3716.  
  3717.       sv_isa  Returns a boolean indicating whether the SV is
  3718.           blessed into the specified class.  This does not
  3719.           check    for subtypes; use sv_derived_from to verify an
  3720.           inheritance relationship.
  3721.  
  3722.               int      sv_isa (SV* sv, char*    name)
  3723.  
  3724.  
  3725.       sv_isobject
  3726.           Returns a boolean indicating whether the SV is an RV
  3727.           pointing to a    blessed    object.     If the    SV is not an
  3728.           RV, or if the    object is not blessed, then this will
  3729.           return false.
  3730.  
  3731.               int      sv_isobject (SV* sv)
  3732.  
  3733.  
  3734.       SvIV      Returns the integer which is in the SV.
  3735.  
  3736.               int SvIV (SV*    sv)
  3737.  
  3738.  
  3739.       SvIVX      Returns the integer which is stored in the SV.
  3740.  
  3741.               int      SvIVX    (SV* sv)
  3742.  
  3743.  
  3744.       SvLEN      Returns the size of the string buffer    in the SV.
  3745.           See SvCUR.
  3746.  
  3747.               int      SvLEN    (SV* sv)
  3748.  
  3749.  
  3750.       sv_len  Returns the length of    the string in the SV.  Use
  3751.           SvCUR.
  3752.  
  3753.               STRLEN  sv_len (SV* sv)
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.      Page 57                        (printed 10/23/98)
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3767.  
  3768.  
  3769.  
  3770.       sv_magic
  3771.           Adds magic to    an SV.
  3772.  
  3773.               void      sv_magic (SV*    sv, SV*    obj, int how, char* name, I32 namlen)
  3774.  
  3775.  
  3776.       sv_mortalcopy
  3777.           Creates a new    SV which is a copy of the original SV.
  3778.           The new SV is    marked as mortal.
  3779.  
  3780.               SV*      sv_mortalcopy    (SV* oldsv)
  3781.  
  3782.  
  3783.       sv_newmortal
  3784.           Creates a new    SV which is mortal.  The reference
  3785.           count    of the SV is set to 1.
  3786.  
  3787.               SV*      sv_newmortal (void)
  3788.  
  3789.  
  3790.       SvNIOK  Returns a boolean indicating whether the SV contains
  3791.           a number, integer or double.
  3792.  
  3793.               int      SvNIOK (SV* SV)
  3794.  
  3795.  
  3796.       SvNIOK_off
  3797.           Unsets the NV/IV status of an    SV.
  3798.  
  3799.               void      SvNIOK_off (SV* sv)
  3800.  
  3801.  
  3802.       SvNIOKp Returns a boolean indicating whether the SV contains
  3803.           a number, integer or double.    Checks the pppprrrriiiivvvvaaaatttteeee
  3804.           setting.  Use    SvNIOK.
  3805.  
  3806.               int      SvNIOKp (SV* SV)
  3807.  
  3808.  
  3809.       PL_sv_no
  3810.           This is the false SV.     See PL_sv_yes.     Always    refer
  3811.           to this as &PL_sv_no.
  3812.  
  3813.       SvNOK      Returns a boolean indicating whether the SV contains
  3814.           a double.
  3815.  
  3816.               int      SvNOK    (SV* SV)
  3817.  
  3818.  
  3819.       SvNOK_off
  3820.           Unsets the NV    status of an SV.
  3821.  
  3822.  
  3823.  
  3824.  
  3825.      Page 58                        (printed 10/23/98)
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3833.  
  3834.  
  3835.  
  3836.               void      SvNOK_off (SV* sv)
  3837.  
  3838.  
  3839.       SvNOK_on
  3840.           Tells    an SV that it is a double.
  3841.  
  3842.               void      SvNOK_on (SV*    sv)
  3843.  
  3844.  
  3845.       SvNOK_only
  3846.           Tells    an SV that it is a double and disables all
  3847.           other    OK bits.
  3848.  
  3849.               void      SvNOK_only (SV* sv)
  3850.  
  3851.  
  3852.       SvNOKp  Returns a boolean indicating whether the SV contains
  3853.           a double.  Checks the    pppprrrriiiivvvvaaaatttteeee    setting.  Use SvNOK.
  3854.  
  3855.               int      SvNOKp (SV* SV)
  3856.  
  3857.  
  3858.       SvNV      Returns the double which is stored in    the SV.
  3859.  
  3860.               double  SvNV (SV* sv)
  3861.  
  3862.  
  3863.       SvNVX      Returns the double which is stored in    the SV.
  3864.  
  3865.               double  SvNVX    (SV* sv)
  3866.  
  3867.  
  3868.       SvOK      Returns a boolean indicating whether the value is an
  3869.           SV.
  3870.  
  3871.               int      SvOK (SV* sv)
  3872.  
  3873.  
  3874.       SvOOK      Returns a boolean indicating whether the SvIVX is a
  3875.           valid    offset value for the SvPVX.  This hack is used
  3876.           internally to    speed up removal of characters from
  3877.           the beginning    of a SvPV.  When SvOOK is true,    then
  3878.           the start of the allocated string buffer is really
  3879.           (SvPVX - SvIVX).
  3880.  
  3881.               int      SvOOK(SV* sv)
  3882.  
  3883.  
  3884.       SvPOK      Returns a boolean indicating whether the SV contains
  3885.           a character string.
  3886.  
  3887.               int      SvPOK    (SV* SV)
  3888.  
  3889.  
  3890.  
  3891.      Page 59                        (printed 10/23/98)
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3899.  
  3900.  
  3901.  
  3902.       SvPOK_off
  3903.           Unsets the PV    status of an SV.
  3904.  
  3905.               void      SvPOK_off (SV* sv)
  3906.  
  3907.  
  3908.       SvPOK_on
  3909.           Tells    an SV that it is a string.
  3910.  
  3911.               void      SvPOK_on (SV*    sv)
  3912.  
  3913.  
  3914.       SvPOK_only
  3915.           Tells    an SV that it is a string and disables all
  3916.           other    OK bits.
  3917.  
  3918.               void      SvPOK_only (SV* sv)
  3919.  
  3920.  
  3921.       SvPOKp  Returns a boolean indicating whether the SV contains
  3922.           a character string.  Checks the pppprrrriiiivvvvaaaatttteeee setting.
  3923.           Use SvPOK.
  3924.  
  3925.               int      SvPOKp (SV* SV)
  3926.  
  3927.  
  3928.       SvPV      Returns a pointer to the string in the SV, or    a
  3929.           stringified form of the SV if    the SV does not
  3930.           contain a string.  If    len is PL_na then Perl will
  3931.           handle the length on its own.     Handles 'get' magic.
  3932.  
  3933.               char*      SvPV (SV* sv,    int len    )
  3934.  
  3935.  
  3936.       SvPV_force
  3937.           Like <SvPV> but will force the SV into becoming a
  3938.           string (SvPOK).  You want force if you are going to
  3939.           update the SvPVX directly.
  3940.  
  3941.               char*      SvPV_force(SV* sv, int len)
  3942.  
  3943.  
  3944.       SvPVX      Returns a pointer to the string in the SV.  The SV
  3945.           must contain a string.
  3946.  
  3947.               char*      SvPVX    (SV* sv)
  3948.  
  3949.  
  3950.       SvREFCNT
  3951.           Returns the value of the object's reference count.
  3952.  
  3953.               int      SvREFCNT (SV*    sv)
  3954.  
  3955.  
  3956.  
  3957.      Page 60                        (printed 10/23/98)
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  3965.  
  3966.  
  3967.  
  3968.       SvREFCNT_dec
  3969.           Decrements the reference count of the    given SV.
  3970.  
  3971.               void      SvREFCNT_dec (SV* sv)
  3972.  
  3973.  
  3974.       SvREFCNT_inc
  3975.           Increments the reference count of the    given SV.
  3976.  
  3977.               void      SvREFCNT_inc (SV* sv)
  3978.  
  3979.  
  3980.       SvROK      Tests    if the SV is an    RV.
  3981.  
  3982.               int      SvROK    (SV* sv)
  3983.  
  3984.  
  3985.       SvROK_off
  3986.           Unsets the RV    status of an SV.
  3987.  
  3988.               void      SvROK_off (SV* sv)
  3989.  
  3990.  
  3991.       SvROK_on
  3992.           Tells    an SV that it is an RV.
  3993.  
  3994.               void      SvROK_on (SV*    sv)
  3995.  
  3996.  
  3997.       SvRV      Dereferences an RV to    return the SV.
  3998.  
  3999.               SV*      SvRV (SV* sv)
  4000.  
  4001.  
  4002.       SvSETMAGIC
  4003.           Invokes mg_set on an SV if it    has 'set' magic.  This
  4004.           macro    evaluates its argument more than once.
  4005.  
  4006.               void      SvSETMAGIC( SV *sv )
  4007.  
  4008.  
  4009.       sv_setiv
  4010.           Copies an integer into the given SV.    Does not
  4011.           handle 'set' magic.  See sv_setiv_mg.
  4012.  
  4013.               void      sv_setiv (SV*    sv, IV num)
  4014.  
  4015.  
  4016.       sv_setiv_mg
  4017.           Like sv_setiv, but also handles 'set'    magic.
  4018.  
  4019.               void      sv_setiv_mg (SV* sv, IV num)
  4020.  
  4021.  
  4022.  
  4023.      Page 61                        (printed 10/23/98)
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4031.  
  4032.  
  4033.  
  4034.       sv_setnv
  4035.           Copies a double into the given SV.  Does not handle
  4036.           'set'    magic.    See sv_setnv_mg.
  4037.  
  4038.               void      sv_setnv (SV*    sv, double num)
  4039.  
  4040.  
  4041.       sv_setnv_mg
  4042.           Like sv_setnv, but also handles 'set'    magic.
  4043.  
  4044.               void      sv_setnv_mg (SV* sv, double num)
  4045.  
  4046.  
  4047.       sv_setpv
  4048.           Copies a string into an SV.  The string must be
  4049.           null-terminated.  Does not handle 'set' magic.  See
  4050.           sv_setpv_mg.
  4051.  
  4052.               void      sv_setpv (SV*    sv, char* ptr)
  4053.  
  4054.  
  4055.       sv_setpv_mg
  4056.           Like sv_setpv, but also handles 'set'    magic.
  4057.  
  4058.               void      sv_setpv_mg (SV* sv, char* ptr)
  4059.  
  4060.  
  4061.       sv_setpviv
  4062.           Copies an integer into the given SV, also updating
  4063.           its string value.  Does not handle 'set' magic.  See
  4064.           sv_setpviv_mg.
  4065.  
  4066.               void      sv_setpviv (SV* sv, IV num)
  4067.  
  4068.  
  4069.       sv_setpviv_mg
  4070.           Like sv_setpviv, but also handles 'set' magic.
  4071.  
  4072.               void      sv_setpviv_mg    (SV* sv, IV num)
  4073.  
  4074.  
  4075.       sv_setpvn
  4076.           Copies a string into an SV.  The len parameter
  4077.           indicates the    number of bytes    to be copied.  Does
  4078.           not handle 'set' magic.  See sv_setpvn_mg.
  4079.  
  4080.               void      sv_setpvn (SV* sv, char* ptr,    STRLEN len)
  4081.  
  4082.  
  4083.       sv_setpvn_mg
  4084.           Like sv_setpvn, but also handles 'set' magic.
  4085.  
  4086.  
  4087.  
  4088.  
  4089.      Page 62                        (printed 10/23/98)
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4097.  
  4098.  
  4099.  
  4100.               void      sv_setpvn_mg (SV* sv,    char* ptr, STRLEN len)
  4101.  
  4102.  
  4103.       sv_setpvf
  4104.           Processes its    arguments like sprintf and sets    an SV
  4105.           to the formatted output.  Does not handle 'set'
  4106.           magic.  See sv_setpvf_mg.
  4107.  
  4108.               void      sv_setpvf (SV* sv, const char* pat, ...)
  4109.  
  4110.  
  4111.       sv_setpvf_mg
  4112.           Like sv_setpvf, but also handles 'set' magic.
  4113.  
  4114.               void      sv_setpvf_mg (SV* sv,    const char* pat, ...)
  4115.  
  4116.  
  4117.       sv_setref_iv
  4118.           Copies an integer into a new SV, optionally blessing
  4119.           the SV.  The rv argument will    be upgraded to an RV.
  4120.           That RV will be modified to point to the new SV.
  4121.           The classname    argument indicates the package for the
  4122.           blessing.  Set classname to Nullch to    avoid the
  4123.           blessing.  The new SV    will be    returned and will have
  4124.           a reference count of 1.
  4125.  
  4126.               SV*      sv_setref_iv (SV *rv,    char *classname, IV iv)
  4127.  
  4128.  
  4129.       sv_setref_nv
  4130.           Copies a double into a new SV, optionally blessing
  4131.           the SV.  The rv argument will    be upgraded to an RV.
  4132.           That RV will be modified to point to the new SV.
  4133.           The classname    argument indicates the package for the
  4134.           blessing.  Set classname to Nullch to    avoid the
  4135.           blessing.  The new SV    will be    returned and will have
  4136.           a reference count of 1.
  4137.  
  4138.               SV*      sv_setref_nv (SV *rv,    char *classname, double    nv)
  4139.  
  4140.  
  4141.       sv_setref_pv
  4142.           Copies a pointer into    a new SV, optionally blessing
  4143.           the SV.  The rv argument will    be upgraded to an RV.
  4144.           That RV will be modified to point to the new SV.  If
  4145.           the pv argument is NULL then PL_sv_undef will    be
  4146.           placed into the SV.  The classname argument
  4147.           indicates the    package    for the    blessing.  Set
  4148.           classname to Nullch to avoid the blessing.  The new
  4149.           SV will be returned and will have a reference    count
  4150.           of 1.
  4151.  
  4152.  
  4153.  
  4154.  
  4155.      Page 63                        (printed 10/23/98)
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4163.  
  4164.  
  4165.  
  4166.               SV*      sv_setref_pv (SV *rv,    char *classname, void* pv)
  4167.  
  4168.           Do not use with integral Perl    types such as HV, AV,
  4169.           SV, CV, because those    objects    will become corrupted
  4170.           by the pointer copy process.
  4171.  
  4172.           Note that sv_setref_pvn copies the string while this
  4173.           copies the pointer.
  4174.  
  4175.       sv_setref_pvn
  4176.           Copies a string into a new SV, optionally blessing
  4177.           the SV.  The length of the string must be specified
  4178.           with n.  The rv argument will    be upgraded to an RV.
  4179.           That RV will be modified to point to the new SV.
  4180.           The classname    argument indicates the package for the
  4181.           blessing.  Set classname to Nullch to    avoid the
  4182.           blessing.  The new SV    will be    returned and will have
  4183.           a reference count of 1.
  4184.  
  4185.               SV*      sv_setref_pvn    (SV *rv, char *classname, char*    pv, I32    n)
  4186.  
  4187.           Note that sv_setref_pv copies    the pointer while this
  4188.           copies the string.
  4189.  
  4190.       SvSetSV Calls    sv_setsv if dsv    is not the same    as ssv.     May
  4191.           evaluate arguments more than once.
  4192.  
  4193.               void      SvSetSV (SV* dsv, SV*    ssv)
  4194.  
  4195.  
  4196.       SvSetSV_nosteal
  4197.           Calls    a non-destructive version of sv_setsv if dsv
  4198.           is not the same as ssv.  May evaluate    arguments more
  4199.           than once.
  4200.  
  4201.               void      SvSetSV_nosteal (SV* dsv, SV*    ssv)
  4202.  
  4203.  
  4204.       sv_setsv
  4205.           Copies the contents of the source SV ssv into    the
  4206.           destination SV dsv.  The source SV may be destroyed
  4207.           if it    is mortal.  Does not handle 'set' magic.  See
  4208.           the macro forms SvSetSV, SvSetSV_nosteal and
  4209.           sv_setsv_mg.
  4210.  
  4211.               void      sv_setsv (SV*    dsv, SV* ssv)
  4212.  
  4213.  
  4214.       sv_setsv_mg
  4215.           Like sv_setsv, but also handles 'set'    magic.
  4216.  
  4217.               void      sv_setsv_mg (SV* dsv,    SV* ssv)
  4218.  
  4219.  
  4220.  
  4221.      Page 64                        (printed 10/23/98)
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4229.  
  4230.  
  4231.  
  4232.       sv_setuv
  4233.           Copies an unsigned integer into the given SV.     Does
  4234.           not handle 'set' magic.  See sv_setuv_mg.
  4235.  
  4236.               void      sv_setuv (SV*    sv, UV num)
  4237.  
  4238.  
  4239.       sv_setuv_mg
  4240.           Like sv_setuv, but also handles 'set'    magic.
  4241.  
  4242.               void      sv_setuv_mg (SV* sv, UV num)
  4243.  
  4244.  
  4245.       SvSTASH Returns the stash of the SV.
  4246.  
  4247.               HV*      SvSTASH (SV* sv)
  4248.  
  4249.  
  4250.       SvTAINT Taints an SV if tainting is enabled
  4251.  
  4252.               void      SvTAINT (SV* sv)
  4253.  
  4254.  
  4255.       SvTAINTED
  4256.           Checks to see    if an SV is tainted. Returns TRUE if
  4257.           it is, FALSE if not.
  4258.  
  4259.               int      SvTAINTED (SV* sv)
  4260.  
  4261.  
  4262.       SvTAINTED_off
  4263.           Untaints an SV. Be _v_e_r_y careful with this routine,
  4264.           as it    short-circuits some of Perl's fundamental
  4265.           security features. XS    module authors should not use
  4266.           this function    unless they fully understand all the
  4267.           implications of unconditionally untainting the
  4268.           value. Untainting should be done in the standard
  4269.           perl fashion,    via a carefully    crafted    regexp,    rather
  4270.           than directly    untainting variables.
  4271.  
  4272.               void      SvTAINTED_off    (SV* sv)
  4273.  
  4274.  
  4275.       SvTAINTED_on
  4276.           Marks    an SV as tainted.
  4277.  
  4278.               void      SvTAINTED_on (SV* sv)
  4279.  
  4280.  
  4281.       SVt_IV  Integer type flag for    scalars.  See svtype.
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.      Page 65                        (printed 10/23/98)
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4295.  
  4296.  
  4297.  
  4298.       SVt_PV  Pointer type flag for    scalars.  See svtype.
  4299.  
  4300.       SVt_PVAV
  4301.           Type flag for    arrays.     See svtype.
  4302.  
  4303.       SVt_PVCV
  4304.           Type flag for    code refs.  See    svtype.
  4305.  
  4306.       SVt_PVHV
  4307.           Type flag for    hashes.     See svtype.
  4308.  
  4309.       SVt_PVMG
  4310.           Type flag for    blessed    scalars.  See svtype.
  4311.  
  4312.       SVt_NV  Double type flag for scalars.     See svtype.
  4313.  
  4314.       SvTRUE  Returns a boolean indicating whether Perl would
  4315.           evaluate the SV as true or false, defined or
  4316.           undefined.  Does not handle 'get' magic.
  4317.  
  4318.               int      SvTRUE (SV* sv)
  4319.  
  4320.  
  4321.       SvTYPE  Returns the type of the SV.  See svtype.
  4322.  
  4323.               svtype  SvTYPE (SV* sv)
  4324.  
  4325.  
  4326.       svtype  An enum of flags for Perl types.  These are found in
  4327.           the file ssssvvvv....hhhh    in the svtype enum.  Test these    flags
  4328.           with the SvTYPE macro.
  4329.  
  4330.       PL_sv_undef
  4331.           This is the undef SV.     Always    refer to this as
  4332.           &PL_sv_undef.
  4333.  
  4334.       sv_unref
  4335.           Unsets the RV    status of the SV, and decrements the
  4336.           reference count of whatever was being    referenced by
  4337.           the RV.  This    can almost be thought of as a reversal
  4338.           of newSVrv.  See SvROK_off.
  4339.  
  4340.               void      sv_unref (SV*    sv)
  4341.  
  4342.  
  4343.       SvUPGRADE
  4344.           Used to upgrade an SV    to a more complex form.     Uses
  4345.           sv_upgrade to    perform    the upgrade if necessary.  See
  4346.           svtype.
  4347.  
  4348.               bool      SvUPGRADE (SV* sv, svtype mt)
  4349.  
  4350.  
  4351.  
  4352.  
  4353.      Page 66                        (printed 10/23/98)
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4361.  
  4362.  
  4363.  
  4364.       sv_upgrade
  4365.           Upgrade an SV    to a more complex form.     Use
  4366.           SvUPGRADE.  See svtype.
  4367.  
  4368.       sv_usepvn
  4369.           Tells    an SV to use ptr to find its string value.
  4370.           Normally the string is stored    inside the SV but
  4371.           sv_usepvn allows the SV to use an outside string.
  4372.           The ptr should point to memory that was allocated by
  4373.           malloc.  The string length, len, must    be supplied.
  4374.           This function    will realloc the memory    pointed    to by
  4375.           ptr, so that pointer should not be freed or used by
  4376.           the programmer after giving it to sv_usepvn.    Does
  4377.           not handle 'set' magic.  See sv_usepvn_mg.
  4378.  
  4379.               void      sv_usepvn (SV* sv, char* ptr,    STRLEN len)
  4380.  
  4381.  
  4382.       sv_usepvn_mg
  4383.           Like sv_usepvn, but also handles 'set' magic.
  4384.  
  4385.               void      sv_usepvn_mg (SV* sv,    char* ptr, STRLEN len)
  4386.  
  4387.  
  4388.       sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale)
  4389.           Processes its    arguments like vsprintf    and appends
  4390.           the formatted    output to an SV.  Uses an array    of SVs
  4391.           if the C style variable argument list    is missing
  4392.           (NULL).  Indicates if    locale information has been
  4393.           used for formatting.
  4394.  
  4395.               void      sv_catpvfn _((SV* sv,    const char* pat, STRLEN    patlen,
  4396.                         va_list    *args, SV **svargs, I32    svmax,
  4397.                         bool *used_locale));
  4398.  
  4399.  
  4400.       sv_vsetpvfn(sv, pat, patlen, args, svargs, svmax, used_locale)
  4401.           Works    like vcatpvfn but copies the text into the SV
  4402.           instead of appending it.
  4403.  
  4404.               void      sv_setpvfn _((SV* sv,    const char* pat, STRLEN    patlen,
  4405.                         va_list    *args, SV **svargs, I32    svmax,
  4406.                         bool *used_locale));
  4407.  
  4408.  
  4409.       SvUV      Returns the unsigned integer which is    in the SV.
  4410.  
  4411.               UV      SvUV(SV* sv)
  4412.  
  4413.  
  4414.       SvUVX      Returns the unsigned integer which is    stored in the
  4415.           SV.
  4416.  
  4417.  
  4418.  
  4419.      Page 67                        (printed 10/23/98)
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4427.  
  4428.  
  4429.  
  4430.               UV      SvUVX(SV* sv)
  4431.  
  4432.  
  4433.       PL_sv_yes
  4434.           This is the true SV.    See PL_sv_no.  Always refer to
  4435.           this as &PL_sv_yes.
  4436.  
  4437.       THIS      Variable which is setup by xsubpp to designate the
  4438.           object in a C++ XSUB.     This is always    the proper
  4439.           type for the C++ object.  See    CLASS and the section
  4440.           on _U_s_i_n_g _X_S _W_i_t_h _C++ in the _p_e_r_l_x_s manpage.
  4441.  
  4442.       toLOWER Converts the specified character to lowercase.
  4443.  
  4444.               int      toLOWER (char    c)
  4445.  
  4446.  
  4447.       toUPPER Converts the specified character to uppercase.
  4448.  
  4449.               int      toUPPER (char    c)
  4450.  
  4451.  
  4452.       warn      This is the XSUB-writer's interface to Perl's    warn
  4453.           function.  Use this function the same    way you    use
  4454.           the C    printf function.  See croak().
  4455.  
  4456.       XPUSHi  Push an integer onto the stack, extending the    stack
  4457.           if necessary.     Handles 'set' magic. See PUSHi.
  4458.  
  4459.               XPUSHi(int d)
  4460.  
  4461.  
  4462.       XPUSHn  Push a double    onto the stack,    extending the stack if
  4463.           necessary.  Handles 'set' magic.  See    PUSHn.
  4464.  
  4465.               XPUSHn(double    d)
  4466.  
  4467.  
  4468.       XPUSHp  Push a string    onto the stack,    extending the stack if
  4469.           necessary.  The len indicates    the length of the
  4470.           string.  Handles 'set' magic.     See PUSHp.
  4471.  
  4472.               XPUSHp(char *c, int len)
  4473.  
  4474.  
  4475.       XPUSHs  Push an SV onto the stack, extending the stack if
  4476.           necessary.  Does not handle 'set' magic.  See    PUSHs.
  4477.  
  4478.               XPUSHs(sv)
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.      Page 68                        (printed 10/23/98)
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4493.  
  4494.  
  4495.  
  4496.       XPUSHu  Push an unsigned integer onto    the stack, extending
  4497.           the stack if necessary.  See PUSHu.
  4498.  
  4499.       XS      Macro    to declare an XSUB and its C parameter list.
  4500.           This is handled by xsubpp.
  4501.  
  4502.       XSRETURN
  4503.           Return from XSUB, indicating number of items on the
  4504.           stack.  This is usually handled by xsubpp.
  4505.  
  4506.               XSRETURN(int x)
  4507.  
  4508.  
  4509.       XSRETURN_EMPTY
  4510.           Return an empty list from an XSUB immediately.
  4511.  
  4512.               XSRETURN_EMPTY;
  4513.  
  4514.  
  4515.       XSRETURN_IV
  4516.           Return an integer from an XSUB immediately.  Uses
  4517.           XST_mIV.
  4518.  
  4519.               XSRETURN_IV(IV v)
  4520.  
  4521.  
  4522.       XSRETURN_NO
  4523.           Return &PL_sv_no from    an XSUB    immediately.  Uses
  4524.           XST_mNO.
  4525.  
  4526.               XSRETURN_NO;
  4527.  
  4528.  
  4529.       XSRETURN_NV
  4530.           Return an double from    an XSUB    immediately.  Uses
  4531.           XST_mNV.
  4532.  
  4533.               XSRETURN_NV(NV v)
  4534.  
  4535.  
  4536.       XSRETURN_PV
  4537.           Return a copy    of a string from an XSUB immediately.
  4538.           Uses XST_mPV.
  4539.  
  4540.               XSRETURN_PV(char *v)
  4541.  
  4542.  
  4543.       XSRETURN_UNDEF
  4544.           Return &PL_sv_undef from an XSUB immediately.     Uses
  4545.           XST_mUNDEF.
  4546.  
  4547.               XSRETURN_UNDEF;
  4548.  
  4549.  
  4550.  
  4551.      Page 69                        (printed 10/23/98)
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4559.  
  4560.  
  4561.  
  4562.       XSRETURN_YES
  4563.           Return &PL_sv_yes from an XSUB immediately.  Uses
  4564.           XST_mYES.
  4565.  
  4566.               XSRETURN_YES;
  4567.  
  4568.  
  4569.       XST_mIV Place    an integer into    the specified position i on
  4570.           the stack.  The value    is stored in a new mortal SV.
  4571.  
  4572.               XST_mIV( int i, IV v )
  4573.  
  4574.  
  4575.       XST_mNV Place    a double into the specified position i on the
  4576.           stack.  The value is stored in a new mortal SV.
  4577.  
  4578.               XST_mNV( int i, NV v )
  4579.  
  4580.  
  4581.       XST_mNO Place    &PL_sv_no into the specified position i    on the
  4582.           stack.
  4583.  
  4584.               XST_mNO( int i )
  4585.  
  4586.  
  4587.       XST_mPV Place    a copy of a string into    the specified position
  4588.           i on the stack.  The value is    stored in a new    mortal
  4589.           SV.
  4590.  
  4591.               XST_mPV( int i, char *v )
  4592.  
  4593.  
  4594.       XST_mUNDEF
  4595.           Place    &PL_sv_undef into the specified    position i on
  4596.           the stack.
  4597.  
  4598.               XST_mUNDEF( int i )
  4599.  
  4600.  
  4601.       XST_mYES
  4602.           Place    &PL_sv_yes into    the specified position i on
  4603.           the stack.
  4604.  
  4605.               XST_mYES( int    i )
  4606.  
  4607.  
  4608.       XS_VERSION
  4609.           The version identifier for an    XS module.  This is
  4610.           usually handled automatically    by
  4611.           ExtUtils::MakeMaker.    See XS_VERSION_BOOTCHECK.
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.      Page 70                        (printed 10/23/98)
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4625.  
  4626.  
  4627.  
  4628.       XS_VERSION_BOOTCHECK
  4629.           Macro    to verify that a PM module's $VERSION variable
  4630.           matches the XS module's XS_VERSION variable.    This
  4631.           is usually handled automatically by xsubpp.  See the
  4632.           section on _T_h_e _V_E_R_S_I_O_N_C_H_E_C_K: _K_e_y_w_o_r_d in the _p_e_r_l_x_s
  4633.           manpage.
  4634.  
  4635.       Zero      The XSUB-writer's interface to the C memzero
  4636.           function.  The d is the destination, n is the    number
  4637.           of items, and    t is the type.
  4638.  
  4639.               void      Zero(    d, n, t    )
  4640.  
  4641.  
  4642.      AAAAUUUUTTTTHHHHOOOORRRRSSSS
  4643.       Until    May 1997, this document    was maintained by Jeff Okamoto
  4644.       <okamoto@corp.hp.com>.  It is    now maintained as part of Perl
  4645.       itself.
  4646.  
  4647.       With lots of help and    suggestions from Dean Roehrich,
  4648.       Malcolm Beattie, Andreas Koenig, Paul    Hudson,    Ilya
  4649.       Zakharevich, Paul Marquess, Neil Bowers, Matthew Green, Tim
  4650.       Bunce, Spider    Boardman, Ulrich Pfeifer, Stephen McCamant,
  4651.       and Gurusamy Sarathy.
  4652.  
  4653.       API Listing originally by Dean Roehrich <roehrich@cray.com>.
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.      Page 71                        (printed 10/23/98)
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.      PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLGGGGUUUUTTTTSSSS((((1111))))
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.  
  4697.  
  4698.  
  4699.  
  4700.  
  4701.  
  4702.  
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.      Page 72                        (printed 10/23/98)
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.